Exemple #1
0
def do_billing_type_get(cc, args):
    '''Display details of a billing type'''
    try:
        billing_type = cc.billing_types.get(args.billing_type_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Billing Type Not Found : %s' %
                               args.billing_type_id)
    else:
        field_labels = ['Id', 'Name', 'Status', 'Code']
        fields = ['id', 'name', 'status', 'code']
        data = dict((f, getattr(billing_type, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #2
0
def do_service_type_get(cc, args):
    '''Get details of a specific service type'''
    try:
        service_type = cc.service_types.get(args.service_type_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Error: Service Type Not Found : %s' %
                               args.service_type_id)
    else:
        field_labels = ['Id', 'Name', 'Code', 'Units', 'Status']
        fields = ['id', 'name', 'code', 'units', 'status']
        data = dict((f, getattr(service_type, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #3
0
def do_discount_type_get(cc, args):
    '''Get the details of a discount type'''
    try:
        discount_type = cc.discount_types.get(args.discount_type_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Discount Type Not Found : %s' %
                               args.discount_type_id)
    else:
        field_labels = ['Id', 'Status', 'Code', 'Name']
        fields = ['id', 'status', 'code', 'name']
        data = dict((f, getattr(discount_type, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #4
0
def do_plan_get(cc, args):
    '''Get the details of a plan'''
    print('Get plan details')
    try:
        plan = cc.plans.get(args.plan_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Plan Not Found : %s' % args.plan_id)
    else:
        field_labels = ['Id', 'Status', 'Code', 'Name', 'Billing Type', 'Rate']
        fields = ['id', 'status', 'code', 'name', 'billing_type', 'rate']
        data = dict((f, getattr(plan, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #5
0
def do_user_billing_type_get(cc, args):
    '''Get details of a specific service type'''
    try:
        user_billing_type = cc.user_billing_types.get(
            args.user_billing_type_id)
    except exc.HTTPNotFound:
        raise exc.CommandError(
            'Error:User Billing Type Mapping Not Found : %s' %
            args.user_billing_type_id)
    else:
        field_labels = ['Id', 'User', 'Billing Type', 'Extra Fields']
        fields = ['id', 'user', 'billing_type', 'extra_fields']
        data = dict((f, getattr(user_billing_type, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #6
0
def do_invoice_get(cc, args):
    '''Get details of a invoice'''
    try:
        invoice = cc.invoices.get(args.invoice_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Invoice Not Found : %s' % args.invoice_id)
    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'
        ]
        data = dict((f, getattr(invoice, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #7
0
def do_discount_get(cc, args):
    '''Get the details of a individual discount'''
    print('Get discount details')
    try:
        discount = cc.discounts.get(args.discount_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Discount Not Found : %s' % args.discount_id)
    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'
        ]
        data = dict((f, getattr(discount, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #8
0
def do_user_plan_get(cc, args):
    '''Get details of a specific service type'''
    try:
        user_plan = cc.user_plans.get(args.user_plan_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Error: User Plan Mapping Not Found : %s' %
                               args.user_plan_id)
    else:
        field_labels = [
            'Id', 'User', 'Plan Id', 'Status', 'Creation Date', 'Quantity',
            'Contract Period'
        ]
        fields = [
            'id', 'user', 'plan_id', 'status', 'created_on', 'qty',
            'contract_period'
        ]
        data = dict((f, getattr(user_plan, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)
Exemple #9
0
def do_discount_mapping_get(cc, args):
    '''Get the details of an individual Discount Mapping'''
    try:
        print(args)
        discount_mapping = cc.discount_mappings.get(args.discount_mapping_id)
    except exc.HTTPNotFound:
        raise exc.CommandError('Error: Discount Mapping Not Found : %s' %
                               args.discount_mapping_id)
    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'
        ]
        data = dict((f, getattr(discount_mapping, f, '')) for f in fields)
        utils.print_dict(data, wrap=72)