Skip to content

Commit

Permalink
[DE-746] Update SDK (#31)
Browse files Browse the repository at this point in the history
- Enabled additional model properties
- Renamed `BulkComponentSPricePointAssignment` to `BulkComponentsPricePointAssignment`
- Add query parameters for list subscription group proforma invoices
- Use ProformaInvoiceStatus for list proforma invoices status query parameter
- Added missing fields in the `Allocation` model
- Added missing `404` errors for subscription components endpoints
- Renamed components price points related models to match the proper camelCase style
- Changed `includeNextProformaInvoice` param type from `String` to an enum
- Add enums for proforma invoices and invoices properties:
  - Invoice Discount Source Type
  - Invoice Discount Type
  - Proforma Invoice Discount Source Type
  - Proforma Invoice Role
  - Proforma Invoice Status
  - Tax Source Type
- Remove `ProformaTaxBreakout`, use `InvoiceTaxBreakout` instead
- Make Proforma Invoice reuse `InvoiceConsolidationLevel` and `CollectionMethod` enums instead of strings
- Remove ProformaInvoiceDiscountBreakout - use InvoiceDiscountBreakout instead
- Add missing fields for ProformaInvoiceDiscount
- Add tests for Proforma Invoices
- Merge proforma invoice and preview proforma, add kind for invoice line item
- Add kind to invoice line item
  • Loading branch information
maciej-nedza authored Mar 4, 2024
1 parent 98419ed commit 219262f
Show file tree
Hide file tree
Showing 499 changed files with 5,652 additions and 1,674 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ The following parameters are configurable for the API Client:
| --- | --- | --- |
| `subdomain` | `str` | The subdomain for your Chargify site.<br>*Default*: `'subdomain'` |
| `domain` | `str` | The Chargify server domain.<br>*Default*: `'chargify.com'` |
| `environment` | Environment | The API environment. <br> **Default: `Environment.PRODUCTION`** |
| `environment` | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
| `http_client_instance` | `HttpClient` | The Http Client passed from the sdk user for making requests |
| `override_http_client_configuration` | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
| `http_call_back` | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
Expand Down
64 changes: 47 additions & 17 deletions advancedbilling/controllers/proforma_invoices_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
from apimatic_core.types.parameter import Parameter
from advancedbilling.http.http_method_enum import HttpMethodEnum
from apimatic_core.authentication.multiple.single_auth import Single
from advancedbilling.models.proforma_invoice import ProformaInvoice
from advancedbilling.models.list_proforma_invoices_response import ListProformaInvoicesResponse
from advancedbilling.models.proforma_invoice_preview import ProformaInvoicePreview
from advancedbilling.models.proforma_invoice import ProformaInvoice
from advancedbilling.models.signup_proforma_preview_response import SignupProformaPreviewResponse
from advancedbilling.exceptions.error_list_response_exception import ErrorListResponseException
from advancedbilling.exceptions.api_exception import APIException
Expand Down Expand Up @@ -75,7 +74,7 @@ def create_consolidated_proforma_invoice(self,
).execute()

def list_subscription_group_proforma_invoices(self,
uid):
options=dict()):
"""Does a GET request to /subscription_groups/{uid}/proforma_invoices.json.
Only proforma invoices with a `consolidation_level` of parent are
Expand All @@ -87,10 +86,22 @@ def list_subscription_group_proforma_invoices(self,
set to true.
Args:
uid (str): The uid of the subscription group
options (dict, optional): Key-value pairs for any of the
parameters to this API Endpoint. All parameters to the
endpoint are supplied through the dictionary with their names
being the key and their desired values being the value. A list
of parameters that can be used are::
uid -- str -- The uid of the subscription group
line_items -- bool -- Include line items data
discounts -- bool -- Include discounts data
taxes -- bool -- Include taxes data
credits -- bool -- Include credits data
payments -- bool -- Include payments data
custom_fields -- bool -- Include custom fields data
Returns:
ProformaInvoice: Response from the API. OK
ListProformaInvoicesResponse: Response from the API. OK
Raises:
APIException: When an error occurs while fetching the data from
Expand All @@ -106,17 +117,35 @@ def list_subscription_group_proforma_invoices(self,
.http_method(HttpMethodEnum.GET)
.template_param(Parameter()
.key('uid')
.value(uid)
.value(options.get('uid', None))
.is_required(True)
.should_encode(True))
.query_param(Parameter()
.key('line_items')
.value(options.get('line_items', None)))
.query_param(Parameter()
.key('discounts')
.value(options.get('discounts', None)))
.query_param(Parameter()
.key('taxes')
.value(options.get('taxes', None)))
.query_param(Parameter()
.key('credits')
.value(options.get('credits', None)))
.query_param(Parameter()
.key('payments')
.value(options.get('payments', None)))
.query_param(Parameter()
.key('custom_fields')
.value(options.get('custom_fields', None)))
.header_param(Parameter()
.key('accept')
.value('application/json'))
.auth(Single('BasicAuth'))
).response(
ResponseHandler()
.deserializer(APIHelper.json_deserialize)
.deserialize_into(ProformaInvoice.from_dictionary)
.deserialize_into(ListProformaInvoicesResponse.from_dictionary)
.local_error_template('404', 'Not Found:\'{$response.body}\'', APIException)
).execute()

Expand Down Expand Up @@ -235,9 +264,9 @@ def list_proforma_invoices(self,
invoice's Due Date, in the YYYY-MM-DD format.
end_date -- str -- The ending date range for the invoice's
Due Date, in the YYYY-MM-DD format.
status -- InvoiceStatus -- The current status of the
invoice. Allowed Values: draft, open, paid, pending,
voided
status -- ProformaInvoiceStatus -- The current status of
the invoice. Allowed Values: draft, open, paid,
pending, voided
page -- int -- Result records are organized in pages. By
default, the first page of results is displayed. The
page parameter specifies a page number of results to
Expand Down Expand Up @@ -412,7 +441,7 @@ def preview_proforma_invoice(self,
subscription_id (int): The Chargify id of the subscription
Returns:
ProformaInvoicePreview: Response from the API. OK
ProformaInvoice: Response from the API. OK
Raises:
APIException: When an error occurs while fetching the data from
Expand All @@ -438,7 +467,7 @@ def preview_proforma_invoice(self,
).response(
ResponseHandler()
.deserializer(APIHelper.json_deserialize)
.deserialize_into(ProformaInvoicePreview.from_dictionary)
.deserialize_into(ProformaInvoice.from_dictionary)
.local_error_template('404', 'Not Found:\'{$response.body}\'', APIException)
.local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}. Response: \'{$response.body}\'.', ErrorListResponseException)
).execute()
Expand Down Expand Up @@ -500,7 +529,7 @@ def create_signup_proforma_invoice(self,
).execute()

def preview_signup_proforma_invoice(self,
include_next_proforma_invoice=None,
include=None,
body=None):
"""Does a POST request to /subscriptions/proforma_invoices/preview.json.
Expand All @@ -519,8 +548,9 @@ def preview_signup_proforma_invoice(self,
minimum requirements.
Args:
include_next_proforma_invoice (str, optional): Choose to include a
proforma invoice preview for the first renewal
include (CreateSignupProformaPreviewInclude, optional): Choose to
include a proforma invoice preview for the first renewal. Use
in query `include=next_proforma_invoice`.
body (CreateSubscriptionRequest, optional): TODO: type description
here.
Expand All @@ -543,8 +573,8 @@ def preview_signup_proforma_invoice(self,
.key('Content-Type')
.value('application/json'))
.query_param(Parameter()
.key('include=next_proforma_invoice')
.value(include_next_proforma_invoice))
.key('include')
.value(include))
.body_param(Parameter()
.value(body))
.header_param(Parameter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from apimatic_core.types.array_serialization_format import SerializationFormats
from apimatic_core.authentication.multiple.single_auth import Single
from advancedbilling.models.subscription_component_response import SubscriptionComponentResponse
from advancedbilling.models.bulk_component_s_price_point_assignment import BulkComponentSPricePointAssignment
from advancedbilling.models.bulk_components_price_point_assignment import BulkComponentsPricePointAssignment
from advancedbilling.models.subscription_response import SubscriptionResponse
from advancedbilling.models.allocation_response import AllocationResponse
from advancedbilling.models.allocation_preview_response import AllocationPreviewResponse
Expand Down Expand Up @@ -237,11 +237,11 @@ def bulk_update_subscription_components_price_points(self,
Args:
subscription_id (int): The Chargify id of the subscription
body (BulkComponentSPricePointAssignment, optional): TODO: type
body (BulkComponentsPricePointAssignment, optional): TODO: type
description here.
Returns:
BulkComponentSPricePointAssignment: Response from the API. OK
BulkComponentsPricePointAssignment: Response from the API. OK
Raises:
APIException: When an error occurs while fetching the data from
Expand Down Expand Up @@ -273,7 +273,7 @@ def bulk_update_subscription_components_price_points(self,
).response(
ResponseHandler()
.deserializer(APIHelper.json_deserialize)
.deserialize_into(BulkComponentSPricePointAssignment.from_dictionary)
.deserialize_into(BulkComponentsPricePointAssignment.from_dictionary)
.local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}. Response: \'{$response.body}\'.', ComponentPricePointErrorException)
).execute()

Expand All @@ -290,7 +290,7 @@ def bulk_reset_subscription_components_price_points(self,
subscription_id (int): The Chargify id of the subscription
Returns:
SubscriptionResponse: Response from the API. OK
SubscriptionResponse: Response from the API. Created
Raises:
APIException: When an error occurs while fetching the data from
Expand Down
14 changes: 9 additions & 5 deletions advancedbilling/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
'billing_schedule',
'billing_address',
'breakouts',
'bulk_component_s_price_point_assignment',
'bulk_components_price_point_assignment',
'bulk_create_product_price_points_request',
'bulk_create_product_price_points_response',
'bulk_create_segments',
Expand All @@ -64,12 +64,12 @@
'component_custom_price',
'component_price',
'component_price_point',
'component_price_point_assignment',
'component_price_point_item',
'component_price_point_response',
'component_price_points_response',
'component_price_point_error_item',
'component_response',
'component_s_price_point_assignment',
'consolidated_invoice',
'count_response',
'coupon',
Expand Down Expand Up @@ -310,12 +310,9 @@
'proforma_invoice',
'proforma_invoice_credit',
'proforma_invoice_discount',
'proforma_invoice_discount_breakout',
'proforma_invoice_issued',
'proforma_invoice_payment',
'proforma_invoice_preview',
'proforma_invoice_tax',
'proforma_invoice_tax_breakout',
'proration',
'public_key',
'public_signup_page',
Expand Down Expand Up @@ -476,6 +473,7 @@
'compounding_strategy',
'create_invoice_status',
'create_prepayment_method',
'create_signup_proforma_preview_include',
'credit_note_status',
'credit_scheme',
'credit_type',
Expand All @@ -494,6 +492,8 @@
'interval_unit',
'invoice_consolidation_level',
'invoice_date_field',
'invoice_discount_source_type',
'invoice_discount_type',
'invoice_event_payment_method',
'invoice_event_type',
'invoice_payment_method_type',
Expand All @@ -516,6 +516,10 @@
'prepayment_method',
'price_point_type',
'pricing_scheme',
'proforma_invoice_discount_source_type',
'proforma_invoice_role',
'proforma_invoice_status',
'proforma_invoice_tax_source_type',
'reactivation_charge',
'recurring_scheme',
'resource_type',
Expand Down
13 changes: 11 additions & 2 deletions advancedbilling/models/account_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ class AccountBalance(object):
]

def __init__(self,
balance_in_cents=APIHelper.SKIP):
balance_in_cents=APIHelper.SKIP,
additional_properties={}):
"""Constructor for the AccountBalance class"""

# Initialize members of the class
if balance_in_cents is not APIHelper.SKIP:
self.balance_in_cents = balance_in_cents

# Add additional model properties to the instance
self.additional_properties = additional_properties

@classmethod
def from_dictionary(cls,
dictionary):
Expand All @@ -57,5 +61,10 @@ def from_dictionary(cls,

# Extract variables from the dictionary
balance_in_cents = dictionary.get("balance_in_cents") if dictionary.get("balance_in_cents") else APIHelper.SKIP
# Clean out expected properties from dictionary
for key in cls._names.values():
if key in dictionary:
del dictionary[key]
# Return an object of this model
return cls(balance_in_cents)
return cls(balance_in_cents,
dictionary)
13 changes: 11 additions & 2 deletions advancedbilling/models/account_balances.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def __init__(self,
open_invoices=APIHelper.SKIP,
pending_discounts=APIHelper.SKIP,
service_credits=APIHelper.SKIP,
prepayments=APIHelper.SKIP):
prepayments=APIHelper.SKIP,
additional_properties={}):
"""Constructor for the AccountBalances class"""

# Initialize members of the class
Expand All @@ -60,6 +61,9 @@ def __init__(self,
if prepayments is not APIHelper.SKIP:
self.prepayments = prepayments

# Add additional model properties to the instance
self.additional_properties = additional_properties

@classmethod
def from_dictionary(cls,
dictionary):
Expand All @@ -83,8 +87,13 @@ def from_dictionary(cls,
pending_discounts = AccountBalance.from_dictionary(dictionary.get('pending_discounts')) if 'pending_discounts' in dictionary.keys() else APIHelper.SKIP
service_credits = AccountBalance.from_dictionary(dictionary.get('service_credits')) if 'service_credits' in dictionary.keys() else APIHelper.SKIP
prepayments = AccountBalance.from_dictionary(dictionary.get('prepayments')) if 'prepayments' in dictionary.keys() else APIHelper.SKIP
# Clean out expected properties from dictionary
for key in cls._names.values():
if key in dictionary:
del dictionary[key]
# Return an object of this model
return cls(open_invoices,
pending_discounts,
service_credits,
prepayments)
prepayments,
dictionary)
13 changes: 11 additions & 2 deletions advancedbilling/models/ach_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def __init__(self,
agreement_terms=APIHelper.SKIP,
authorizer_first_name=APIHelper.SKIP,
authorizer_last_name=APIHelper.SKIP,
ip_address=APIHelper.SKIP):
ip_address=APIHelper.SKIP,
additional_properties={}):
"""Constructor for the ACHAgreement class"""

# Initialize members of the class
Expand All @@ -62,6 +63,9 @@ def __init__(self,
if ip_address is not APIHelper.SKIP:
self.ip_address = ip_address

# Add additional model properties to the instance
self.additional_properties = additional_properties

@classmethod
def from_dictionary(cls,
dictionary):
Expand All @@ -85,11 +89,16 @@ def from_dictionary(cls,
authorizer_first_name = dictionary.get("authorizer_first_name") if dictionary.get("authorizer_first_name") else APIHelper.SKIP
authorizer_last_name = dictionary.get("authorizer_last_name") if dictionary.get("authorizer_last_name") else APIHelper.SKIP
ip_address = dictionary.get("ip_address") if dictionary.get("ip_address") else APIHelper.SKIP
# Clean out expected properties from dictionary
for key in cls._names.values():
if key in dictionary:
del dictionary[key]
# Return an object of this model
return cls(agreement_terms,
authorizer_first_name,
authorizer_last_name,
ip_address)
ip_address,
dictionary)

@classmethod
def validate(cls, dictionary):
Expand Down
13 changes: 11 additions & 2 deletions advancedbilling/models/activate_subscription_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ class ActivateSubscriptionRequest(object):
]

def __init__(self,
revert_on_failure=APIHelper.SKIP):
revert_on_failure=APIHelper.SKIP,
additional_properties={}):
"""Constructor for the ActivateSubscriptionRequest class"""

# Initialize members of the class
if revert_on_failure is not APIHelper.SKIP:
self.revert_on_failure = revert_on_failure

# Add additional model properties to the instance
self.additional_properties = additional_properties

@classmethod
def from_dictionary(cls,
dictionary):
Expand All @@ -66,5 +70,10 @@ def from_dictionary(cls,

# Extract variables from the dictionary
revert_on_failure = dictionary.get("revert_on_failure") if "revert_on_failure" in dictionary.keys() else APIHelper.SKIP
# Clean out expected properties from dictionary
for key in cls._names.values():
if key in dictionary:
del dictionary[key]
# Return an object of this model
return cls(revert_on_failure)
return cls(revert_on_failure,
dictionary)
Loading

0 comments on commit 219262f

Please sign in to comment.