Example #1
0
def do_discount_type_list(cc, args):
    '''List all Discount Types'''
    try:
        discount_types = cc.discount_types.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error: No Discount Types Found!')
    else:
        field_labels = ['Id', 'Status', 'Code', 'Name']
        fields = ['id', 'status', 'code', 'name']
        utils.print_list(discount_types, fields, field_labels, sortby=0)
Example #2
0
def do_service_types_list(cc, args):
    '''List all service types'''
    try:
        service_types = cc.service_types.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error: No Service Types Found!')
    else:
        field_labels = ['Id', 'Name', 'Code', 'Units', 'Status']
        fields = ['id', 'name', 'code', 'units', 'status']
        utils.print_list(service_types, fields, field_labels, sortby=0)
Example #3
0
def do_user_billing_type_list(cc, args):
    '''List all User Plans'''
    try:
        user_billing_types = cc.user_billing_types.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error: No User Billing Types Found!')
    else:
        field_labels = ['Id', 'User', 'Billing Type', 'Extra Fields']
        fields = ['id', 'user', 'billing_type', 'extra_fields']
        utils.print_list(user_billing_types, fields, field_labels, sortby=0)
Example #4
0
def do_plan_list(cc, args):
    '''List all the available plans'''
    try:
        plans = cc.plans.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error:No Plans Found!')
    else:
        field_labels = ['Id', 'Status', 'Code', 'Name', 'Billing Type', 'Rate']
        fields = ['id', 'status', 'code', 'name', 'billing_type', 'rate']
        utils.print_list(plans, fields, field_labels, sortby=0)
Example #5
0
def do_billing_type_list(cc, args):
    """
    List the billing types
    """
    try:
        billing_types = cc.billing_types.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error:No Billing Types Found!')
    else:
        field_labels = ['Id', 'Name', 'Status', 'Code']
        fields = ['id', 'name', 'status', 'code']
        utils.print_list(billing_types, fields, field_labels, sortby=0)
Example #6
0
def do_discount_mappings_list(cc, args):
    '''List all Discount Mappings'''
    try:
        discount_mapping = cc.discount_mappings.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error: No Discount Mappings Found!')
    else:
        field_labels = [
            'Discount_Type_Id', 'Code', 'Name', 'User', 'Apply Type',
            'User Plan', 'Discount Id', 'Expiration Date', 'Amt'
        ]
        fields = [
            'discount_type_id', 'code', 'name', 'user', 'apply_type',
            'user_plan', 'discount_id', 'expiration_date', 'amt'
        ]
        utils.print_list(discount_mapping, fields, field_labels, sortby=0)
Example #7
0
def do_discount_list(cc, args):
    '''List all discounts'''
    try:
        discounts = cc.discounts.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error: No Discounts Found!')
    else:
        field_labels = [
            'Id', 'Code', 'Name', 'Discount_Type_Id', 'Discount_Type_Code',
            'Expiration Date', 'Amt', 'Usage Count'
        ]
        fields = [
            'id', 'code', 'name', 'discount_type_id', 'discount_type_code',
            'expiration_date', 'amt', 'usage_count'
        ]
        utils.print_list(discounts, fields, field_labels, sortby=0)
Example #8
0
def do_invoice_list(cc, args):
    '''List Invoices'''
    try:
        invoices = cc.invoices.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error: No Invoices Found!')
    else:
        field_labels = [
            'Code', 'Date', 'From', 'To', 'User', 'Total', 'Paid Amount',
            'Balance'
        ]
        fields = [
            'inv_code', 'inv_date', 'inv_from', 'inv_to', 'user', 'total_amt',
            'amt_paid', 'balance_amt'
        ]
        utils.print_list(invoices, fields, field_labels, sortby=0)
Example #9
0
def do_user_plans_list(cc, args):
    '''List all User Plans'''
    try:
        user_plans = cc.user_plans.list()
    except exc.HTTPNotFound():
        raise exc.CommandError('Error: No User Plans Found!')
    else:
        field_labels = [
            'Id', 'User', 'Plan Id', 'Status', 'Creation Date', 'Quantity',
            'Contract Period'
        ]
        fields = [
            'id', 'user', 'plan_id', 'status', 'created_on', 'qty',
            'contract_period'
        ]
        utils.print_list(user_plans, fields, field_labels, sortby=0)