Skip to content

Commit

Permalink
SDK Updates (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
patryk-grudzien-keen authored Jan 26, 2024
1 parent 5826d21 commit 088bad3
Show file tree
Hide file tree
Showing 191 changed files with 16,121 additions and 17,526 deletions.
60 changes: 30 additions & 30 deletions advancedbilling/controllers/advance_invoice_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,25 @@ def issue_advance_invoice(self,
.local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}. Response: \'{$response.body}\'.', ErrorListResponseException)
).execute()

def read_advance_invoice(self,
subscription_id):
"""Does a GET request to /subscriptions/{subscription_id}/advance_invoice.json.
def void_advance_invoice(self,
subscription_id,
body=None):
"""Does a POST request to /subscriptions/{subscription_id}/advance_invoice/void.json.
Once an advance invoice has been generated for a subscription's
upcoming renewal, it can be viewed through this endpoint. There can
only be one advance invoice per subscription per billing cycle.
Void a subscription's existing advance invoice. Once voided, it can
later be regenerated if desired.
A `reason` is required in order to void, and the invoice must have an
open status. Voiding will cause any prepayments and credits that were
applied to the invoice to be returned to the subscription. For a full
overview of the impact of voiding, please [see our help
docs](reference/Chargify-API.v1.yaml/components/schemas/Invoice).
Args:
subscription_id (int): The Chargify id of the subscription
body (VoidInvoiceRequest, optional): TODO: type description here.
Returns:
Invoice: Response from the API. OK
Invoice: Response from the API. Created
Raises:
APIException: When an error occurs while fetching the data from
Expand All @@ -118,16 +124,22 @@ def read_advance_invoice(self,

return super().new_api_call_builder.request(
RequestBuilder().server(Server.DEFAULT)
.path('/subscriptions/{subscription_id}/advance_invoice.json')
.http_method(HttpMethodEnum.GET)
.path('/subscriptions/{subscription_id}/advance_invoice/void.json')
.http_method(HttpMethodEnum.POST)
.template_param(Parameter()
.key('subscription_id')
.value(subscription_id)
.is_required(True)
.should_encode(True))
.header_param(Parameter()
.key('Content-Type')
.value('application/json'))
.body_param(Parameter()
.value(body))
.header_param(Parameter()
.key('accept')
.value('application/json'))
.body_serializer(APIHelper.json_serialize)
.auth(Single('global'))
).response(
ResponseHandler()
Expand All @@ -136,25 +148,19 @@ def read_advance_invoice(self,
.local_error_template('404', 'Not Found:\'{$response.body}\'', APIException)
).execute()

def void_advance_invoice(self,
subscription_id,
body=None):
"""Does a POST request to /subscriptions/{subscription_id}/advance_invoice/void.json.
def read_advance_invoice(self,
subscription_id):
"""Does a GET request to /subscriptions/{subscription_id}/advance_invoice.json.
Void a subscription's existing advance invoice. Once voided, it can
later be regenerated if desired.
A `reason` is required in order to void, and the invoice must have an
open status. Voiding will cause any prepayments and credits that were
applied to the invoice to be returned to the subscription. For a full
overview of the impact of voiding, please [see our help
docs](reference/Chargify-API.v1.yaml/components/schemas/Invoice).
Once an advance invoice has been generated for a subscription's
upcoming renewal, it can be viewed through this endpoint. There can
only be one advance invoice per subscription per billing cycle.
Args:
subscription_id (int): The Chargify id of the subscription
body (VoidInvoiceRequest, optional): TODO: type description here.
Returns:
Invoice: Response from the API. Created
Invoice: Response from the API. OK
Raises:
APIException: When an error occurs while fetching the data from
Expand All @@ -166,22 +172,16 @@ def void_advance_invoice(self,

return super().new_api_call_builder.request(
RequestBuilder().server(Server.DEFAULT)
.path('/subscriptions/{subscription_id}/advance_invoice/void.json')
.http_method(HttpMethodEnum.POST)
.path('/subscriptions/{subscription_id}/advance_invoice.json')
.http_method(HttpMethodEnum.GET)
.template_param(Parameter()
.key('subscription_id')
.value(subscription_id)
.is_required(True)
.should_encode(True))
.header_param(Parameter()
.key('Content-Type')
.value('application/json'))
.body_param(Parameter()
.value(body))
.header_param(Parameter()
.key('accept')
.value('application/json'))
.body_serializer(APIHelper.json_serialize)
.auth(Single('global'))
).response(
ResponseHandler()
Expand Down
Loading

0 comments on commit 088bad3

Please sign in to comment.