Class: AdvancedBilling::SubscriptionGroupInvoiceAccountController
- Inherits:
-
BaseController
- Object
- BaseController
- AdvancedBilling::SubscriptionGroupInvoiceAccountController
- Defined in:
- lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb
Overview
SubscriptionGroupInvoiceAccountController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_subscription_group_prepayment(uid, body: nil) ⇒ SubscriptionGroupPrepaymentResponse
A prepayment can be added for a subscription group identified by the group’s ‘uid`.
-
#deduct_subscription_group_service_credit(uid, body: nil) ⇒ ServiceCredit
Credit can be deducted for a subscription group identified by the group’s ‘uid`.
-
#issue_subscription_group_service_credit(uid, body: nil) ⇒ ServiceCreditResponse
Credit can be issued for a subscription group identified by the group’s ‘uid`.
-
#list_prepayments_for_subscription_group(options = {}) ⇒ ListSubscriptionGroupPrepaymentResponse
This request will list a subscription group’s prepayments.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from AdvancedBilling::BaseController
Instance Method Details
#create_subscription_group_prepayment(uid, body: nil) ⇒ SubscriptionGroupPrepaymentResponse
A prepayment can be added for a subscription group identified by the group’s ‘uid`. This endpoint requires a `amount`, `details`, `method`, and `memo`. On success, the prepayment will be added to the group’s prepayment balance. group Example:
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb', line 18 def create_subscription_group_prepayment(uid, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/subscription_groups/{uid}/prepayments.json', Server::DEFAULT) .template_param(new_parameter(uid, key: 'uid') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SubscriptionGroupPrepaymentResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#deduct_subscription_group_service_credit(uid, body: nil) ⇒ ServiceCredit
Credit can be deducted for a subscription group identified by the group’s ‘uid`. Credit will be deducted from the group in the amount specified in the request body. group
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb', line 121 def deduct_subscription_group_service_credit(uid, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/subscription_groups/{uid}/service_credit_deductions.json', Server::DEFAULT) .template_param(new_parameter(uid, key: 'uid') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ServiceCredit.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#issue_subscription_group_service_credit(uid, body: nil) ⇒ ServiceCreditResponse
Credit can be issued for a subscription group identified by the group’s ‘uid`. Credit will be added to the group in the amount specified in the request body. The credit will be applied to group member invoices as they are generated. group
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb', line 90 def issue_subscription_group_service_credit(uid, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/subscription_groups/{uid}/service_credits.json', Server::DEFAULT) .template_param(new_parameter(uid, key: 'uid') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ServiceCreditResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#list_prepayments_for_subscription_group(options = {}) ⇒ ListSubscriptionGroupPrepaymentResponse
This request will list a subscription group’s prepayments. group pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned. Use in query ‘page=1`. many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200. Use in query `per_page=200`. for List Prepayments operations
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb', line 59 def list_prepayments_for_subscription_group( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/subscription_groups/{uid}/prepayments.json', Server::DEFAULT) .template_param(new_parameter(['uid'], key: 'uid') .is_required(true) .should_encode(true)) .query_param(new_parameter(['page'], key: 'page')) .query_param(new_parameter(['per_page'], key: 'per_page')) .query_param(new_parameter(['filter'], key: 'filter')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth')) .array_serialization_format(ArraySerializationFormat::CSV)) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ListSubscriptionGroupPrepaymentResponse.method(:from_hash)) .local_error_template('404', 'Not Found:\'{$response.body}\'', APIException)) .execute end |