diff --git a/README.md b/README.md index 87e2cde3..74fc8bb4 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,9 @@ client = AdvancedBillingClient( basic_auth_credentials=BasicAuthCredentials( username='BasicAuthUserName', password='BasicAuthPassword' - ) + ), + subdomain='subdomain', + domain='chargify.com' ) ``` diff --git a/advancedbilling/models/__init__.py b/advancedbilling/models/__init__.py index 4e4f9427..76c13c9a 100644 --- a/advancedbilling/models/__init__.py +++ b/advancedbilling/models/__init__.py @@ -1,10 +1,25 @@ __all__ = [ - 'invoice_event_payment', 'payment_method_apple_pay', 'payment_method_bank_account', 'payment_method_credit_card', 'payment_method_external', 'payment_method_paypal', + 'apply_credit_note_event', + 'apply_debit_note_event', + 'apply_payment_event', + 'backport_invoice_event', + 'change_chargeback_status_event', + 'change_invoice_collection_method_event', + 'change_invoice_status_event', + 'create_credit_note_event', + 'create_debit_note_event', + 'failed_payment_event', + 'issue_invoice_event', + 'refund_invoice_event', + 'remove_payment_event', + 'void_invoice_event', + 'void_remainder_event', + 'list_invoice_events_response', 'account_balance', 'account_balances', 'ach_agreement', @@ -40,7 +55,6 @@ 'billing_manifest', 'billing_manifest_item', 'billing_schedule', - 'billing_address', 'breakouts', 'bulk_components_price_point_assignment', 'bulk_create_product_price_points_request', @@ -153,7 +167,6 @@ 'credit_note', 'credit_note_application', 'credit_note_line_item', - 'credit_note_1', 'credit_scheme_request', 'currency_price', 'currency_prices_response', @@ -166,7 +179,6 @@ 'customer_error', 'customer_payer_change', 'customer_response', - 'customer_1', 'debit_note', 'deduct_service_credit', 'deduct_service_credit_request', @@ -202,15 +214,11 @@ 'invoice_discount', 'invoice_discount_breakout', 'invoice_display_settings', - 'invoice_event', - 'invoice_event_data', - 'invoice_event_payment_1', 'invoice_issued', 'invoice_line_item', 'invoice_line_item_component_cost_data', 'invoice_line_item_event_data', 'invoice_line_item_pricing_detail', - 'invoice_line_item_1', 'invoice_payer', 'invoice_payer_change', 'invoice_payment', @@ -235,7 +243,6 @@ 'list_components_price_points_response', 'list_coupons_filter', 'list_credit_notes_response', - 'list_invoice_events_response', 'list_invoices_response', 'list_metafields_response', 'list_mrr_filter', @@ -313,7 +320,6 @@ 'prepayments_response', 'preview_allocations_request', 'price', - 'price_point', 'product', 'product_family', 'product_family_response', @@ -343,7 +349,6 @@ 'record_payment_response', 'referral_code', 'referral_validation_response', - 'refund', 'refund_consolidated_invoice', 'refund_invoice', 'refund_invoice_event_data', @@ -370,11 +375,9 @@ 'segment', 'segment_price', 'segment_response', - 'seller', 'send_invoice_request', 'service_credit', 'service_credit_response', - 'shipping_address', 'signup_proforma_preview', 'signup_proforma_preview_response', 'site', @@ -521,7 +524,6 @@ 'invoice_payment_method_type', 'invoice_payment_type', 'invoice_role', - 'invoice_role_1', 'invoice_sort_field', 'invoice_status', 'item_category', diff --git a/advancedbilling/models/apply_credit_note_event.py b/advancedbilling/models/apply_credit_note_event.py new file mode 100644 index 00000000..407cd59f --- /dev/null +++ b/advancedbilling/models/apply_credit_note_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.apply_credit_note_event_data import ApplyCreditNoteEventData +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class ApplyCreditNoteEvent(object): + + """Implementation of the 'Apply Credit Note Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (ApplyCreditNoteEventData): Example schema for an + `apply_credit_note` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='apply_credit_note', + event_data=None, + additional_properties={}): + """Constructor for the ApplyCreditNoteEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'apply_credit_note' + event_data = ApplyCreditNoteEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: ApplyCreditNoteEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: ApplyCreditNoteEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/apply_credit_note_event_data.py b/advancedbilling/models/apply_credit_note_event_data.py index 466ffb4f..0d4293b1 100644 --- a/advancedbilling/models/apply_credit_note_event_data.py +++ b/advancedbilling/models/apply_credit_note_event_data.py @@ -164,17 +164,27 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.uid, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.credit_note_number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.credit_note_uid, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.original_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.applied_amount, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.uid, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.credit_note_number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.credit_note_uid, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.original_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.applied_amount, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('uid'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('credit_note_number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('credit_note_uid'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('original_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('uid'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('credit_note_number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('credit_note_uid'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('original_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/apply_debit_note_event.py b/advancedbilling/models/apply_debit_note_event.py new file mode 100644 index 00000000..3205c1ae --- /dev/null +++ b/advancedbilling/models/apply_debit_note_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.apply_debit_note_event_data import ApplyDebitNoteEventData +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class ApplyDebitNoteEvent(object): + + """Implementation of the 'Apply Debit Note Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (ApplyDebitNoteEventData): Example schema for an + `apply_debit_note` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='apply_debit_note', + event_data=None, + additional_properties={}): + """Constructor for the ApplyDebitNoteEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'apply_debit_note' + event_data = ApplyDebitNoteEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: ApplyDebitNoteEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: ApplyDebitNoteEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/apply_debit_note_event_data.py b/advancedbilling/models/apply_debit_note_event_data.py index 8dc6bd3c..48e202dc 100644 --- a/advancedbilling/models/apply_debit_note_event_data.py +++ b/advancedbilling/models/apply_debit_note_event_data.py @@ -129,15 +129,23 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.debit_note_number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.debit_note_uid, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.original_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.applied_amount, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.debit_note_number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.debit_note_uid, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.original_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.applied_amount, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('debit_note_number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('debit_note_uid'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('original_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('debit_note_number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('debit_note_uid'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('original_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/apply_payment_event.py b/advancedbilling/models/apply_payment_event.py new file mode 100644 index 00000000..a3743fcf --- /dev/null +++ b/advancedbilling/models/apply_payment_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.apply_payment_event_data import ApplyPaymentEventData +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class ApplyPaymentEvent(object): + + """Implementation of the 'Apply Payment Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (ApplyPaymentEventData): Example schema for an + `apply_payment` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='apply_payment', + event_data=None, + additional_properties={}): + """Constructor for the ApplyPaymentEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'apply_payment' + event_data = ApplyPaymentEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: ApplyPaymentEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: ApplyPaymentEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/apply_payment_event_data.py b/advancedbilling/models/apply_payment_event_data.py index d69b8e0c..4709c8df 100644 --- a/advancedbilling/models/apply_payment_event_data.py +++ b/advancedbilling/models/apply_payment_event_data.py @@ -175,19 +175,29 @@ def validate(cls, dictionary): from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.consolidation_level, type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.original_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.applied_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.transaction_time, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + return APIHelper.is_valid_type(value=dictionary.consolidation_level, + type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.original_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.applied_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.transaction_time, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ and UnionTypeLookUp.get('Invoice-Event-Payment').validate(dictionary.payment_method).is_valid if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('consolidation_level'), type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('original_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), type_callable=lambda value: isinstance(value, str)) \ + return APIHelper.is_valid_type(value=dictionary.get('consolidation_level'), + type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('original_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), + type_callable=lambda value: isinstance(value, str)) \ and UnionTypeLookUp.get('Invoice-Event-Payment').validate(dictionary.get('payment_method')).is_valid diff --git a/advancedbilling/models/backport_invoice_event.py b/advancedbilling/models/backport_invoice_event.py new file mode 100644 index 00000000..101bc8b6 --- /dev/null +++ b/advancedbilling/models/backport_invoice_event.py @@ -0,0 +1,135 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class BackportInvoiceEvent(object): + + """Implementation of the 'Backport Invoice Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (Invoice): Example schema for an `backport_invoice` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='backport_invoice', + event_data=None, + additional_properties={}): + """Constructor for the BackportInvoiceEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'backport_invoice' + event_data = Invoice.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/bank_account_payment_profile.py b/advancedbilling/models/bank_account_payment_profile.py index 03652c6c..c693b27d 100644 --- a/advancedbilling/models/bank_account_payment_profile.py +++ b/advancedbilling/models/bank_account_payment_profile.py @@ -279,11 +279,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.masked_bank_routing_number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.masked_bank_account_number, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.masked_bank_routing_number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.masked_bank_account_number, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('masked_bank_routing_number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('masked_bank_account_number'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('masked_bank_routing_number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('masked_bank_account_number'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/billing_address.py b/advancedbilling/models/billing_address.py deleted file mode 100644 index c3b21e30..00000000 --- a/advancedbilling/models/billing_address.py +++ /dev/null @@ -1,141 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper - - -class BillingAddress(object): - - """Implementation of the 'BillingAddress' model. - - TODO: type model description here. - - Attributes: - street (str): TODO: type description here. - line_2 (str): TODO: type description here. - city (str): TODO: type description here. - state (str): TODO: type description here. - zip (str): TODO: type description here. - country (str): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "street": 'street', - "line_2": 'line2', - "city": 'city', - "state": 'state', - "zip": 'zip', - "country": 'country' - } - - _optionals = [ - 'street', - 'line_2', - 'city', - 'state', - 'zip', - 'country', - ] - - _nullables = [ - 'street', - 'line_2', - 'city', - 'state', - 'zip', - 'country', - ] - - def __init__(self, - street=APIHelper.SKIP, - line_2=APIHelper.SKIP, - city=APIHelper.SKIP, - state=APIHelper.SKIP, - zip=APIHelper.SKIP, - country=APIHelper.SKIP, - additional_properties={}): - """Constructor for the BillingAddress class""" - - # Initialize members of the class - if street is not APIHelper.SKIP: - self.street = street - if line_2 is not APIHelper.SKIP: - self.line_2 = line_2 - if city is not APIHelper.SKIP: - self.city = city - if state is not APIHelper.SKIP: - self.state = state - if zip is not APIHelper.SKIP: - self.zip = zip - if country is not APIHelper.SKIP: - self.country = country - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - street = dictionary.get("street") if "street" in dictionary.keys() else APIHelper.SKIP - line_2 = dictionary.get("line2") if "line2" in dictionary.keys() else APIHelper.SKIP - city = dictionary.get("city") if "city" in dictionary.keys() else APIHelper.SKIP - state = dictionary.get("state") if "state" in dictionary.keys() else APIHelper.SKIP - zip = dictionary.get("zip") if "zip" in dictionary.keys() else APIHelper.SKIP - country = dictionary.get("country") if "country" 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(street, - line_2, - city, - state, - zip, - country, - dictionary) - - @classmethod - def validate(cls, dictionary): - """Validates dictionary against class required properties - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - boolean : if dictionary is valid contains required properties. - - """ - - if isinstance(dictionary, cls): - return True - - if not isinstance(dictionary, dict): - return False - - return True diff --git a/advancedbilling/models/change_chargeback_status_event.py b/advancedbilling/models/change_chargeback_status_event.py new file mode 100644 index 00000000..881f60bc --- /dev/null +++ b/advancedbilling/models/change_chargeback_status_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.change_chargeback_status_event_data import ChangeChargebackStatusEventData +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class ChangeChargebackStatusEvent(object): + + """Implementation of the 'Change Chargeback Status Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (ChangeChargebackStatusEventData): Example schema for an + `change_chargeback_status` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='change_chargeback_status', + event_data=None, + additional_properties={}): + """Constructor for the ChangeChargebackStatusEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'change_chargeback_status' + event_data = ChangeChargebackStatusEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: ChangeChargebackStatusEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: ChangeChargebackStatusEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/change_chargeback_status_event_data.py b/advancedbilling/models/change_chargeback_status_event_data.py index f46ba62e..0c2635be 100644 --- a/advancedbilling/models/change_chargeback_status_event_data.py +++ b/advancedbilling/models/change_chargeback_status_event_data.py @@ -80,9 +80,11 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.chargeback_status, type_callable=lambda value: ChargebackStatus.validate(value)) + return APIHelper.is_valid_type(value=dictionary.chargeback_status, + type_callable=lambda value: ChargebackStatus.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('chargeback_status'), type_callable=lambda value: ChargebackStatus.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('chargeback_status'), + type_callable=lambda value: ChargebackStatus.validate(value)) diff --git a/advancedbilling/models/change_invoice_collection_method_event.py b/advancedbilling/models/change_invoice_collection_method_event.py new file mode 100644 index 00000000..96c213ef --- /dev/null +++ b/advancedbilling/models/change_invoice_collection_method_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.change_invoice_collection_method_event_data import ChangeInvoiceCollectionMethodEventData +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class ChangeInvoiceCollectionMethodEvent(object): + + """Implementation of the 'Change Invoice Collection Method Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (ChangeInvoiceCollectionMethodEventData): Example schema + for an `change_invoice_collection_method` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='change_invoice_collection_method', + event_data=None, + additional_properties={}): + """Constructor for the ChangeInvoiceCollectionMethodEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'change_invoice_collection_method' + event_data = ChangeInvoiceCollectionMethodEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: ChangeInvoiceCollectionMethodEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: ChangeInvoiceCollectionMethodEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/change_invoice_collection_method_event_data.py b/advancedbilling/models/change_invoice_collection_method_event_data.py index 6e279675..dc6704dd 100644 --- a/advancedbilling/models/change_invoice_collection_method_event_data.py +++ b/advancedbilling/models/change_invoice_collection_method_event_data.py @@ -86,11 +86,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.from_collection_method, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.to_collection_method, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.from_collection_method, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.to_collection_method, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('from_collection_method'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('to_collection_method'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('from_collection_method'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('to_collection_method'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/change_invoice_status_event.py b/advancedbilling/models/change_invoice_status_event.py new file mode 100644 index 00000000..77131eca --- /dev/null +++ b/advancedbilling/models/change_invoice_status_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.change_invoice_status_event_data import ChangeInvoiceStatusEventData +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class ChangeInvoiceStatusEvent(object): + + """Implementation of the 'Change Invoice Status Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (ChangeInvoiceStatusEventData): Example schema for an + `change_invoice_status` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='change_invoice_status', + event_data=None, + additional_properties={}): + """Constructor for the ChangeInvoiceStatusEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'change_invoice_status' + event_data = ChangeInvoiceStatusEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: ChangeInvoiceStatusEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: ChangeInvoiceStatusEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/change_invoice_status_event_data.py b/advancedbilling/models/change_invoice_status_event_data.py index 20257ce4..b84adc89 100644 --- a/advancedbilling/models/change_invoice_status_event_data.py +++ b/advancedbilling/models/change_invoice_status_event_data.py @@ -122,11 +122,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.from_status, type_callable=lambda value: InvoiceStatus.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.to_status, type_callable=lambda value: InvoiceStatus.validate(value)) + return APIHelper.is_valid_type(value=dictionary.from_status, + type_callable=lambda value: InvoiceStatus.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.to_status, + type_callable=lambda value: InvoiceStatus.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('from_status'), type_callable=lambda value: InvoiceStatus.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('to_status'), type_callable=lambda value: InvoiceStatus.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('from_status'), + type_callable=lambda value: InvoiceStatus.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('to_status'), + type_callable=lambda value: InvoiceStatus.validate(value)) diff --git a/advancedbilling/models/component_allocation_change.py b/advancedbilling/models/component_allocation_change.py index 56968d97..c6e8c8f2 100644 --- a/advancedbilling/models/component_allocation_change.py +++ b/advancedbilling/models/component_allocation_change.py @@ -121,19 +121,31 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.previous_allocation, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.new_allocation, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.component_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.component_handle, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.allocation_id, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.previous_allocation, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.new_allocation, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.component_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.component_handle, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.allocation_id, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('previous_allocation'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('new_allocation'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('component_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('component_handle'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('allocation_id'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('previous_allocation'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('new_allocation'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('component_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('component_handle'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('allocation_id'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/create_component_price_point.py b/advancedbilling/models/create_component_price_point.py index eba53d8f..59b7f42b 100644 --- a/advancedbilling/models/create_component_price_point.py +++ b/advancedbilling/models/create_component_price_point.py @@ -147,13 +147,23 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.pricing_scheme, type_callable=lambda value: PricingScheme.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.prices, type_callable=lambda value: Price.validate(value)) + return APIHelper.is_valid_type(value=dictionary.name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.pricing_scheme, + type_callable=lambda value: PricingScheme.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.prices, + type_callable=lambda value: Price.validate(value), + is_model_dict=True, + is_inner_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('pricing_scheme'), type_callable=lambda value: PricingScheme.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('prices'), type_callable=lambda value: Price.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('pricing_scheme'), + type_callable=lambda value: PricingScheme.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('prices'), + type_callable=lambda value: Price.validate(value), + is_model_dict=True, + is_inner_model_dict=True) diff --git a/advancedbilling/models/create_credit_note_event.py b/advancedbilling/models/create_credit_note_event.py new file mode 100644 index 00000000..cc81d048 --- /dev/null +++ b/advancedbilling/models/create_credit_note_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.credit_note import CreditNote +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class CreateCreditNoteEvent(object): + + """Implementation of the 'Create Credit Note Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (CreditNote): Example schema for an `create_credit_note` + event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='create_credit_note', + event_data=None, + additional_properties={}): + """Constructor for the CreateCreditNoteEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'create_credit_note' + event_data = CreditNote.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: CreditNote.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: CreditNote.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/create_debit_note_event.py b/advancedbilling/models/create_debit_note_event.py new file mode 100644 index 00000000..b7f66fb8 --- /dev/null +++ b/advancedbilling/models/create_debit_note_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.debit_note import DebitNote +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class CreateDebitNoteEvent(object): + + """Implementation of the 'Create Debit Note Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (DebitNote): Example schema for an `create_debit_note` + event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='create_debit_note', + event_data=None, + additional_properties={}): + """Constructor for the CreateDebitNoteEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'create_debit_note' + event_data = DebitNote.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: DebitNote.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: DebitNote.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/create_invoice_payment_application.py b/advancedbilling/models/create_invoice_payment_application.py index 042f7779..d07af76c 100644 --- a/advancedbilling/models/create_invoice_payment_application.py +++ b/advancedbilling/models/create_invoice_payment_application.py @@ -87,11 +87,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.invoice_uid, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.amount, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.invoice_uid, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.amount, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('invoice_uid'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('amount'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('invoice_uid'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('amount'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/create_multi_invoice_payment.py b/advancedbilling/models/create_multi_invoice_payment.py index 69421d85..2d7e7f1d 100644 --- a/advancedbilling/models/create_multi_invoice_payment.py +++ b/advancedbilling/models/create_multi_invoice_payment.py @@ -131,10 +131,16 @@ def validate(cls, dictionary): if isinstance(dictionary, cls): return UnionTypeLookUp.get('CreateMultiInvoicePaymentAmount').validate(dictionary.amount).is_valid \ - and APIHelper.is_valid_type(value=dictionary.applications, type_callable=lambda value: CreateInvoicePaymentApplication.validate(value)) + and APIHelper.is_valid_type(value=dictionary.applications, + type_callable=lambda value: CreateInvoicePaymentApplication.validate(value), + is_model_dict=True, + is_inner_model_dict=True) if not isinstance(dictionary, dict): return False return UnionTypeLookUp.get('CreateMultiInvoicePaymentAmount').validate(dictionary.get('amount')).is_valid \ - and APIHelper.is_valid_type(value=dictionary.get('applications'), type_callable=lambda value: CreateInvoicePaymentApplication.validate(value)) + and APIHelper.is_valid_type(value=dictionary.get('applications'), + type_callable=lambda value: CreateInvoicePaymentApplication.validate(value), + is_model_dict=True, + is_inner_model_dict=True) diff --git a/advancedbilling/models/create_or_update_flat_amount_coupon.py b/advancedbilling/models/create_or_update_flat_amount_coupon.py index 0d88b721..a8904cac 100644 --- a/advancedbilling/models/create_or_update_flat_amount_coupon.py +++ b/advancedbilling/models/create_or_update_flat_amount_coupon.py @@ -177,13 +177,19 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.code, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.amount_in_cents, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.code, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.amount_in_cents, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('code'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('amount_in_cents'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('code'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('amount_in_cents'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/create_or_update_percentage_coupon.py b/advancedbilling/models/create_or_update_percentage_coupon.py index a8a7896d..0b0fac39 100644 --- a/advancedbilling/models/create_or_update_percentage_coupon.py +++ b/advancedbilling/models/create_or_update_percentage_coupon.py @@ -179,13 +179,17 @@ def validate(cls, dictionary): from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.code, type_callable=lambda value: isinstance(value, str)) \ + return APIHelper.is_valid_type(value=dictionary.name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.code, + type_callable=lambda value: isinstance(value, str)) \ and UnionTypeLookUp.get('CreateOrUpdatePercentageCouponPercentage').validate(dictionary.percentage).is_valid if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('code'), type_callable=lambda value: isinstance(value, str)) \ + return APIHelper.is_valid_type(value=dictionary.get('name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('code'), + type_callable=lambda value: isinstance(value, str)) \ and UnionTypeLookUp.get('CreateOrUpdatePercentageCouponPercentage').validate(dictionary.get('percentage')).is_valid diff --git a/advancedbilling/models/create_prepaid_usage_component_price_point.py b/advancedbilling/models/create_prepaid_usage_component_price_point.py index b4681e5d..bd4c5a55 100644 --- a/advancedbilling/models/create_prepaid_usage_component_price_point.py +++ b/advancedbilling/models/create_prepaid_usage_component_price_point.py @@ -163,15 +163,29 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.pricing_scheme, type_callable=lambda value: PricingScheme.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.prices, type_callable=lambda value: Price.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.overage_pricing, type_callable=lambda value: OveragePricing.validate(value)) + return APIHelper.is_valid_type(value=dictionary.name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.pricing_scheme, + type_callable=lambda value: PricingScheme.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.prices, + type_callable=lambda value: Price.validate(value), + is_model_dict=True, + is_inner_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.overage_pricing, + type_callable=lambda value: OveragePricing.validate(value), + is_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('pricing_scheme'), type_callable=lambda value: PricingScheme.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('prices'), type_callable=lambda value: Price.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('overage_pricing'), type_callable=lambda value: OveragePricing.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('pricing_scheme'), + type_callable=lambda value: PricingScheme.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('prices'), + type_callable=lambda value: Price.validate(value), + is_model_dict=True, + is_inner_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('overage_pricing'), + type_callable=lambda value: OveragePricing.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/create_subscription.py b/advancedbilling/models/create_subscription.py index d3784309..201046cf 100644 --- a/advancedbilling/models/create_subscription.py +++ b/advancedbilling/models/create_subscription.py @@ -324,7 +324,7 @@ def __init__(self, custom_price=APIHelper.SKIP, coupon_code=APIHelper.SKIP, coupon_codes=APIHelper.SKIP, - payment_collection_method='automatic', + payment_collection_method=APIHelper.SKIP, receives_invoice_emails=APIHelper.SKIP, net_terms=APIHelper.SKIP, customer_id=APIHelper.SKIP, @@ -384,7 +384,8 @@ def __init__(self, self.coupon_code = coupon_code if coupon_codes is not APIHelper.SKIP: self.coupon_codes = coupon_codes - self.payment_collection_method = payment_collection_method + if payment_collection_method is not APIHelper.SKIP: + self.payment_collection_method = payment_collection_method if receives_invoice_emails is not APIHelper.SKIP: self.receives_invoice_emails = receives_invoice_emails if net_terms is not APIHelper.SKIP: @@ -496,7 +497,7 @@ def from_dictionary(cls, custom_price = SubscriptionCustomPrice.from_dictionary(dictionary.get('custom_price')) if 'custom_price' in dictionary.keys() else APIHelper.SKIP coupon_code = dictionary.get("coupon_code") if dictionary.get("coupon_code") else APIHelper.SKIP coupon_codes = dictionary.get("coupon_codes") if dictionary.get("coupon_codes") else APIHelper.SKIP - payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else 'automatic' + payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else APIHelper.SKIP receives_invoice_emails = dictionary.get("receives_invoice_emails") if dictionary.get("receives_invoice_emails") else APIHelper.SKIP net_terms = dictionary.get("net_terms") if dictionary.get("net_terms") else APIHelper.SKIP customer_id = dictionary.get("customer_id") if dictionary.get("customer_id") else APIHelper.SKIP diff --git a/advancedbilling/models/credit_account_balance_changed.py b/advancedbilling/models/credit_account_balance_changed.py index b18a528c..8282a377 100644 --- a/advancedbilling/models/credit_account_balance_changed.py +++ b/advancedbilling/models/credit_account_balance_changed.py @@ -105,17 +105,27 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.reason, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.service_credit_account_balance_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.service_credit_balance_change_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.currency_code, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.at_time, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) + return APIHelper.is_valid_type(value=dictionary.reason, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.service_credit_account_balance_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.service_credit_balance_change_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.currency_code, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.at_time, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('reason'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('service_credit_account_balance_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('service_credit_balance_change_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('currency_code'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('at_time'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('reason'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('service_credit_account_balance_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('service_credit_balance_change_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('currency_code'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('at_time'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/credit_card_payment_profile.py b/advancedbilling/models/credit_card_payment_profile.py index b0530154..6b7674ce 100644 --- a/advancedbilling/models/credit_card_payment_profile.py +++ b/advancedbilling/models/credit_card_payment_profile.py @@ -281,9 +281,11 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.masked_card_number, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.masked_card_number, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('masked_card_number'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('masked_card_number'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/credit_note_1.py b/advancedbilling/models/credit_note_1.py deleted file mode 100644 index 23d70b2c..00000000 --- a/advancedbilling/models/credit_note_1.py +++ /dev/null @@ -1,375 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -import dateutil.parser - -from advancedbilling.api_helper import APIHelper -from advancedbilling.models.billing_address import BillingAddress -from advancedbilling.models.credit_note_application import CreditNoteApplication -from advancedbilling.models.credit_note_line_item import CreditNoteLineItem -from advancedbilling.models.customer_1 import Customer1 -from advancedbilling.models.invoice_discount import InvoiceDiscount -from advancedbilling.models.invoice_refund import InvoiceRefund -from advancedbilling.models.invoice_tax import InvoiceTax -from advancedbilling.models.origin_invoice import OriginInvoice -from advancedbilling.models.seller import Seller -from advancedbilling.models.shipping_address import ShippingAddress - - -class CreditNote1(object): - - """Implementation of the 'Credit Note1' model. - - TODO: type model description here. - - Attributes: - uid (str): Unique identifier for the credit note. It is generated - automatically by Chargify and has the prefix "cn_" followed by - alphanumeric characters. - site_id (int): ID of the site to which the credit note belongs. - customer_id (int): ID of the customer to which the credit note - belongs. - subscription_id (int): ID of the subscription that generated the - credit note. - number (str): A unique, identifying string that appears on the credit - note and in places it is referenced. While the UID is long and - not appropriate to show to customers, the number is usually - shorter and consumable by the customer and the merchant alike. - sequence_number (int): A monotonically increasing number assigned to - credit notes as they are created. This number is unique within a - site and can be used to sort and order credit notes. - issue_date (date): Date the credit note was issued to the customer. - This is the date that the credit was made available for - application, and may come before it is fully applied. The format - is `"YYYY-MM-DD"`. - applied_date (date): Credit notes are applied to invoices to offset - invoiced amounts - they reduce the amount due. This field is the - date the credit note became fully applied to invoices. If the - credit note has been partially applied, this field will not have a - value until it has been fully applied. The format is - `"YYYY-MM-DD"`. - status (CreditNoteStatus): Current status of the credit note. - currency (str): The ISO 4217 currency code (3 character string) - representing the currency of the credit note amount fields. - memo (str): The memo printed on credit note, which is a description of - the reason for the credit. - seller (Seller): TODO: type description here. - customer (Customer1): TODO: type description here. - billing_address (BillingAddress): TODO: type description here. - shipping_address (ShippingAddress): TODO: type description here. - subtotal_amount (str): Subtotal of the credit note, which is the sum - of all line items before discounts or taxes. Note that this is a - positive amount representing the credit back to the customer. - discount_amount (str): Total discount applied to the credit note. Note - that this is a positive amount representing the discount amount - being credited back to the customer (i.e. a credit on an earlier - discount). For example, if the original purchase was $1.00 and the - original discount was $0.10, a credit of $0.50 of the original - purchase (half) would have a discount credit of $0.05 (also - half). - tax_amount (str): Total tax of the credit note. Note that this is a - positive amount representing a previously taxex amount being - credited back to the customer (i.e. a credit of an earlier tax). - For example, if the original purchase was $1.00 and the original - tax was $0.10, a credit of $0.50 of the original purchase (half) - would also have a tax credit of $0.05 (also half). - total_amount (str): The credit note total, which is `subtotal_amount - - discount_amount + tax_amount`.' - applied_amount (str): The amount of the credit note that has already - been applied to invoices. - remaining_amount (str): The amount of the credit note remaining to be - applied to invoices, which is `total_amount - applied_amount`. - line_items (List[CreditNoteLineItem]): Line items on the credit note. - discounts (List[InvoiceDiscount]): TODO: type description here. - taxes (List[InvoiceTax]): TODO: type description here. - applications (List[CreditNoteApplication]): TODO: type description - here. - refunds (List[InvoiceRefund]): TODO: type description here. - origin_invoices (List[OriginInvoice]): An array of origin invoices for - the credit note. Learn more about [Origin Invoice from our - docs](https://chargify.zendesk.com/hc/en-us/articles/4407753036699# - origin-invoices) - - """ - - # Create a mapping from Model property names to API property names - _names = { - "uid": 'uid', - "site_id": 'site_id', - "customer_id": 'customer_id', - "subscription_id": 'subscription_id', - "number": 'number', - "sequence_number": 'sequence_number', - "issue_date": 'issue_date', - "applied_date": 'applied_date', - "status": 'status', - "currency": 'currency', - "memo": 'memo', - "seller": 'seller', - "customer": 'customer', - "billing_address": 'billing_address', - "shipping_address": 'shipping_address', - "subtotal_amount": 'subtotal_amount', - "discount_amount": 'discount_amount', - "tax_amount": 'tax_amount', - "total_amount": 'total_amount', - "applied_amount": 'applied_amount', - "remaining_amount": 'remaining_amount', - "line_items": 'line_items', - "discounts": 'discounts', - "taxes": 'taxes', - "applications": 'applications', - "refunds": 'refunds', - "origin_invoices": 'origin_invoices' - } - - _optionals = [ - 'uid', - 'site_id', - 'customer_id', - 'subscription_id', - 'number', - 'sequence_number', - 'issue_date', - 'applied_date', - 'status', - 'currency', - 'memo', - 'seller', - 'customer', - 'billing_address', - 'shipping_address', - 'subtotal_amount', - 'discount_amount', - 'tax_amount', - 'total_amount', - 'applied_amount', - 'remaining_amount', - 'line_items', - 'discounts', - 'taxes', - 'applications', - 'refunds', - 'origin_invoices', - ] - - def __init__(self, - uid=APIHelper.SKIP, - site_id=APIHelper.SKIP, - customer_id=APIHelper.SKIP, - subscription_id=APIHelper.SKIP, - number=APIHelper.SKIP, - sequence_number=APIHelper.SKIP, - issue_date=APIHelper.SKIP, - applied_date=APIHelper.SKIP, - status=APIHelper.SKIP, - currency=APIHelper.SKIP, - memo=APIHelper.SKIP, - seller=APIHelper.SKIP, - customer=APIHelper.SKIP, - billing_address=APIHelper.SKIP, - shipping_address=APIHelper.SKIP, - subtotal_amount=APIHelper.SKIP, - discount_amount=APIHelper.SKIP, - tax_amount=APIHelper.SKIP, - total_amount=APIHelper.SKIP, - applied_amount=APIHelper.SKIP, - remaining_amount=APIHelper.SKIP, - line_items=APIHelper.SKIP, - discounts=APIHelper.SKIP, - taxes=APIHelper.SKIP, - applications=APIHelper.SKIP, - refunds=APIHelper.SKIP, - origin_invoices=APIHelper.SKIP, - additional_properties={}): - """Constructor for the CreditNote1 class""" - - # Initialize members of the class - if uid is not APIHelper.SKIP: - self.uid = uid - if site_id is not APIHelper.SKIP: - self.site_id = site_id - if customer_id is not APIHelper.SKIP: - self.customer_id = customer_id - if subscription_id is not APIHelper.SKIP: - self.subscription_id = subscription_id - if number is not APIHelper.SKIP: - self.number = number - if sequence_number is not APIHelper.SKIP: - self.sequence_number = sequence_number - if issue_date is not APIHelper.SKIP: - self.issue_date = issue_date - if applied_date is not APIHelper.SKIP: - self.applied_date = applied_date - if status is not APIHelper.SKIP: - self.status = status - if currency is not APIHelper.SKIP: - self.currency = currency - if memo is not APIHelper.SKIP: - self.memo = memo - if seller is not APIHelper.SKIP: - self.seller = seller - if customer is not APIHelper.SKIP: - self.customer = customer - if billing_address is not APIHelper.SKIP: - self.billing_address = billing_address - if shipping_address is not APIHelper.SKIP: - self.shipping_address = shipping_address - if subtotal_amount is not APIHelper.SKIP: - self.subtotal_amount = subtotal_amount - if discount_amount is not APIHelper.SKIP: - self.discount_amount = discount_amount - if tax_amount is not APIHelper.SKIP: - self.tax_amount = tax_amount - if total_amount is not APIHelper.SKIP: - self.total_amount = total_amount - if applied_amount is not APIHelper.SKIP: - self.applied_amount = applied_amount - if remaining_amount is not APIHelper.SKIP: - self.remaining_amount = remaining_amount - if line_items is not APIHelper.SKIP: - self.line_items = line_items - if discounts is not APIHelper.SKIP: - self.discounts = discounts - if taxes is not APIHelper.SKIP: - self.taxes = taxes - if applications is not APIHelper.SKIP: - self.applications = applications - if refunds is not APIHelper.SKIP: - self.refunds = refunds - if origin_invoices is not APIHelper.SKIP: - self.origin_invoices = origin_invoices - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - uid = dictionary.get("uid") if dictionary.get("uid") else APIHelper.SKIP - site_id = dictionary.get("site_id") if dictionary.get("site_id") else APIHelper.SKIP - customer_id = dictionary.get("customer_id") if dictionary.get("customer_id") else APIHelper.SKIP - subscription_id = dictionary.get("subscription_id") if dictionary.get("subscription_id") else APIHelper.SKIP - number = dictionary.get("number") if dictionary.get("number") else APIHelper.SKIP - sequence_number = dictionary.get("sequence_number") if dictionary.get("sequence_number") else APIHelper.SKIP - issue_date = dateutil.parser.parse(dictionary.get('issue_date')).date() if dictionary.get('issue_date') else APIHelper.SKIP - applied_date = dateutil.parser.parse(dictionary.get('applied_date')).date() if dictionary.get('applied_date') else APIHelper.SKIP - status = dictionary.get("status") if dictionary.get("status") else APIHelper.SKIP - currency = dictionary.get("currency") if dictionary.get("currency") else APIHelper.SKIP - memo = dictionary.get("memo") if dictionary.get("memo") else APIHelper.SKIP - seller = Seller.from_dictionary(dictionary.get('seller')) if 'seller' in dictionary.keys() else APIHelper.SKIP - customer = Customer1.from_dictionary(dictionary.get('customer')) if 'customer' in dictionary.keys() else APIHelper.SKIP - billing_address = BillingAddress.from_dictionary(dictionary.get('billing_address')) if 'billing_address' in dictionary.keys() else APIHelper.SKIP - shipping_address = ShippingAddress.from_dictionary(dictionary.get('shipping_address')) if 'shipping_address' in dictionary.keys() else APIHelper.SKIP - subtotal_amount = dictionary.get("subtotal_amount") if dictionary.get("subtotal_amount") else APIHelper.SKIP - discount_amount = dictionary.get("discount_amount") if dictionary.get("discount_amount") else APIHelper.SKIP - tax_amount = dictionary.get("tax_amount") if dictionary.get("tax_amount") else APIHelper.SKIP - total_amount = dictionary.get("total_amount") if dictionary.get("total_amount") else APIHelper.SKIP - applied_amount = dictionary.get("applied_amount") if dictionary.get("applied_amount") else APIHelper.SKIP - remaining_amount = dictionary.get("remaining_amount") if dictionary.get("remaining_amount") else APIHelper.SKIP - line_items = None - if dictionary.get('line_items') is not None: - line_items = [CreditNoteLineItem.from_dictionary(x) for x in dictionary.get('line_items')] - else: - line_items = APIHelper.SKIP - discounts = None - if dictionary.get('discounts') is not None: - discounts = [InvoiceDiscount.from_dictionary(x) for x in dictionary.get('discounts')] - else: - discounts = APIHelper.SKIP - taxes = None - if dictionary.get('taxes') is not None: - taxes = [InvoiceTax.from_dictionary(x) for x in dictionary.get('taxes')] - else: - taxes = APIHelper.SKIP - applications = None - if dictionary.get('applications') is not None: - applications = [CreditNoteApplication.from_dictionary(x) for x in dictionary.get('applications')] - else: - applications = APIHelper.SKIP - refunds = None - if dictionary.get('refunds') is not None: - refunds = [InvoiceRefund.from_dictionary(x) for x in dictionary.get('refunds')] - else: - refunds = APIHelper.SKIP - origin_invoices = None - if dictionary.get('origin_invoices') is not None: - origin_invoices = [OriginInvoice.from_dictionary(x) for x in dictionary.get('origin_invoices')] - else: - origin_invoices = 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(uid, - site_id, - customer_id, - subscription_id, - number, - sequence_number, - issue_date, - applied_date, - status, - currency, - memo, - seller, - customer, - billing_address, - shipping_address, - subtotal_amount, - discount_amount, - tax_amount, - total_amount, - applied_amount, - remaining_amount, - line_items, - discounts, - taxes, - applications, - refunds, - origin_invoices, - dictionary) - - @classmethod - def validate(cls, dictionary): - """Validates dictionary against class required properties - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - boolean : if dictionary is valid contains required properties. - - """ - - if isinstance(dictionary, cls): - return True - - if not isinstance(dictionary, dict): - return False - - return True diff --git a/advancedbilling/models/custom_field_value_change.py b/advancedbilling/models/custom_field_value_change.py index e2e1bc9e..45a2602c 100644 --- a/advancedbilling/models/custom_field_value_change.py +++ b/advancedbilling/models/custom_field_value_change.py @@ -120,21 +120,39 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.event_type, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.metafield_name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.metafield_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.old_value, type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.new_value, type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.resource_type, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.resource_id, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.metafield_name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.metafield_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.old_value, + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.new_value, + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.resource_type, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.resource_id, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('event_type'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('metafield_name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('metafield_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('old_value'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('new_value'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('resource_type'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('resource_id'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('metafield_name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('metafield_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('old_value'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('new_value'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('resource_type'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('resource_id'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/customer_1.py b/advancedbilling/models/customer_1.py deleted file mode 100644 index 04e178d7..00000000 --- a/advancedbilling/models/customer_1.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper - - -class Customer1(object): - - """Implementation of the 'Customer1' model. - - TODO: type model description here. - - Attributes: - chargify_id (int): TODO: type description here. - first_name (str): TODO: type description here. - last_name (str): TODO: type description here. - organization (str): TODO: type description here. - email (str): TODO: type description here. - vat_number (str): TODO: type description here. - reference (str): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "chargify_id": 'chargify_id', - "first_name": 'first_name', - "last_name": 'last_name', - "organization": 'organization', - "email": 'email', - "vat_number": 'vat_number', - "reference": 'reference' - } - - _optionals = [ - 'chargify_id', - 'first_name', - 'last_name', - 'organization', - 'email', - 'vat_number', - 'reference', - ] - - _nullables = [ - 'chargify_id', - 'organization', - 'vat_number', - 'reference', - ] - - def __init__(self, - chargify_id=APIHelper.SKIP, - first_name=APIHelper.SKIP, - last_name=APIHelper.SKIP, - organization=APIHelper.SKIP, - email=APIHelper.SKIP, - vat_number=APIHelper.SKIP, - reference=APIHelper.SKIP, - additional_properties={}): - """Constructor for the Customer1 class""" - - # Initialize members of the class - if chargify_id is not APIHelper.SKIP: - self.chargify_id = chargify_id - if first_name is not APIHelper.SKIP: - self.first_name = first_name - if last_name is not APIHelper.SKIP: - self.last_name = last_name - if organization is not APIHelper.SKIP: - self.organization = organization - if email is not APIHelper.SKIP: - self.email = email - if vat_number is not APIHelper.SKIP: - self.vat_number = vat_number - if reference is not APIHelper.SKIP: - self.reference = reference - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - chargify_id = dictionary.get("chargify_id") if "chargify_id" in dictionary.keys() else APIHelper.SKIP - first_name = dictionary.get("first_name") if dictionary.get("first_name") else APIHelper.SKIP - last_name = dictionary.get("last_name") if dictionary.get("last_name") else APIHelper.SKIP - organization = dictionary.get("organization") if "organization" in dictionary.keys() else APIHelper.SKIP - email = dictionary.get("email") if dictionary.get("email") else APIHelper.SKIP - vat_number = dictionary.get("vat_number") if "vat_number" in dictionary.keys() else APIHelper.SKIP - reference = dictionary.get("reference") if "reference" 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(chargify_id, - first_name, - last_name, - organization, - email, - vat_number, - reference, - dictionary) - - @classmethod - def validate(cls, dictionary): - """Validates dictionary against class required properties - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - boolean : if dictionary is valid contains required properties. - - """ - - if isinstance(dictionary, cls): - return True - - if not isinstance(dictionary, dict): - return False - - return True diff --git a/advancedbilling/models/dunner_data.py b/advancedbilling/models/dunner_data.py index 8171e796..ea984123 100644 --- a/advancedbilling/models/dunner_data.py +++ b/advancedbilling/models/dunner_data.py @@ -109,19 +109,31 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.state, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.subscription_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.revenue_at_risk_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.created_at, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ - and APIHelper.is_valid_type(value=dictionary.attempts, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.last_attempted_at, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) + return APIHelper.is_valid_type(value=dictionary.state, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.subscription_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.revenue_at_risk_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.created_at, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.attempts, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.last_attempted_at, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('state'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('subscription_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('revenue_at_risk_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('created_at'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('attempts'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('last_attempted_at'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('state'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('subscription_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('revenue_at_risk_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('created_at'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('attempts'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('last_attempted_at'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/dunning_step_data.py b/advancedbilling/models/dunning_step_data.py index 8562611c..3ee26503 100644 --- a/advancedbilling/models/dunning_step_data.py +++ b/advancedbilling/models/dunning_step_data.py @@ -136,17 +136,27 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.day_threshold, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.action, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.send_email, type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.send_bcc_email, type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.send_sms, type_callable=lambda value: isinstance(value, bool)) + return APIHelper.is_valid_type(value=dictionary.day_threshold, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.action, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.send_email, + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.send_bcc_email, + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.send_sms, + type_callable=lambda value: isinstance(value, bool)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('day_threshold'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('action'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('send_email'), type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.get('send_bcc_email'), type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.get('send_sms'), type_callable=lambda value: isinstance(value, bool)) + return APIHelper.is_valid_type(value=dictionary.get('day_threshold'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('action'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('send_email'), + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.get('send_bcc_email'), + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.get('send_sms'), + type_callable=lambda value: isinstance(value, bool)) diff --git a/advancedbilling/models/dunning_step_reached.py b/advancedbilling/models/dunning_step_reached.py index c2b28710..c4c30ec7 100644 --- a/advancedbilling/models/dunning_step_reached.py +++ b/advancedbilling/models/dunning_step_reached.py @@ -93,13 +93,25 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.dunner, type_callable=lambda value: DunnerData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.current_step, type_callable=lambda value: DunningStepData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.next_step, type_callable=lambda value: DunningStepData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.dunner, + type_callable=lambda value: DunnerData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.current_step, + type_callable=lambda value: DunningStepData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.next_step, + type_callable=lambda value: DunningStepData.validate(value), + is_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('dunner'), type_callable=lambda value: DunnerData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('current_step'), type_callable=lambda value: DunningStepData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('next_step'), type_callable=lambda value: DunningStepData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('dunner'), + type_callable=lambda value: DunnerData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('current_step'), + type_callable=lambda value: DunningStepData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('next_step'), + type_callable=lambda value: DunningStepData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/event.py b/advancedbilling/models/event.py index 76967b64..4fcf6e8d 100644 --- a/advancedbilling/models/event.py +++ b/advancedbilling/models/event.py @@ -131,21 +131,37 @@ def validate(cls, dictionary): from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.key, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.message, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.subscription_id, type_callable=lambda value: isinstance(value, int), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.customer_id, type_callable=lambda value: isinstance(value, int), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.created_at, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.key, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.message, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.subscription_id, + type_callable=lambda value: isinstance(value, int), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.customer_id, + type_callable=lambda value: isinstance(value, int), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.created_at, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ and UnionTypeLookUp.get('EventEventSpecificData').validate(dictionary.event_specific_data).is_valid if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('key'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('message'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('subscription_id'), type_callable=lambda value: isinstance(value, int), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('customer_id'), type_callable=lambda value: isinstance(value, int), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('created_at'), type_callable=lambda value: isinstance(value, str)) \ + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('key'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('message'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('subscription_id'), + type_callable=lambda value: isinstance(value, int), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('customer_id'), + type_callable=lambda value: isinstance(value, int), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('created_at'), + type_callable=lambda value: isinstance(value, str)) \ and UnionTypeLookUp.get('EventEventSpecificData').validate(dictionary.get('event_specific_data')).is_valid diff --git a/advancedbilling/models/failed_payment_event.py b/advancedbilling/models/failed_payment_event.py new file mode 100644 index 00000000..1f67d857 --- /dev/null +++ b/advancedbilling/models/failed_payment_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.failed_payment_event_data import FailedPaymentEventData +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType + + +class FailedPaymentEvent(object): + + """Implementation of the 'Failed Payment Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (FailedPaymentEventData): Example schema for an + `failed_payment` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='failed_payment', + event_data=None, + additional_properties={}): + """Constructor for the FailedPaymentEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'failed_payment' + event_data = FailedPaymentEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: FailedPaymentEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: FailedPaymentEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/failed_payment_event_data.py b/advancedbilling/models/failed_payment_event_data.py index 08a49158..d397fdd0 100644 --- a/advancedbilling/models/failed_payment_event_data.py +++ b/advancedbilling/models/failed_payment_event_data.py @@ -116,15 +116,23 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.amount_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.applied_amount, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.payment_method, type_callable=lambda value: InvoicePaymentMethodType.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.transaction_id, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.amount_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.applied_amount, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.payment_method, + type_callable=lambda value: InvoicePaymentMethodType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.transaction_id, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('amount_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('payment_method'), type_callable=lambda value: InvoicePaymentMethodType.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('transaction_id'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('amount_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('payment_method'), + type_callable=lambda value: InvoicePaymentMethodType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('transaction_id'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/group_settings.py b/advancedbilling/models/group_settings.py index ba30f7e1..ca4af9c4 100644 --- a/advancedbilling/models/group_settings.py +++ b/advancedbilling/models/group_settings.py @@ -94,9 +94,13 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.target, type_callable=lambda value: GroupTarget.validate(value)) + return APIHelper.is_valid_type(value=dictionary.target, + type_callable=lambda value: GroupTarget.validate(value), + is_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('target'), type_callable=lambda value: GroupTarget.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('target'), + type_callable=lambda value: GroupTarget.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/group_target.py b/advancedbilling/models/group_target.py index 14847f50..88830be6 100644 --- a/advancedbilling/models/group_target.py +++ b/advancedbilling/models/group_target.py @@ -95,9 +95,11 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.mtype, type_callable=lambda value: GroupTargetType.validate(value)) + return APIHelper.is_valid_type(value=dictionary.mtype, + type_callable=lambda value: GroupTargetType.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('type'), type_callable=lambda value: GroupTargetType.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('type'), + type_callable=lambda value: GroupTargetType.validate(value)) diff --git a/advancedbilling/models/invoice.py b/advancedbilling/models/invoice.py index f64a0892..de54af19 100644 --- a/advancedbilling/models/invoice.py +++ b/advancedbilling/models/invoice.py @@ -278,7 +278,7 @@ def __init__(self, status=APIHelper.SKIP, role=APIHelper.SKIP, parent_invoice_id=APIHelper.SKIP, - collection_method='automatic', + collection_method=APIHelper.SKIP, payment_instructions=APIHelper.SKIP, currency=APIHelper.SKIP, consolidation_level=APIHelper.SKIP, @@ -350,7 +350,8 @@ def __init__(self, self.role = role if parent_invoice_id is not APIHelper.SKIP: self.parent_invoice_id = parent_invoice_id - self.collection_method = collection_method + if collection_method is not APIHelper.SKIP: + self.collection_method = collection_method if payment_instructions is not APIHelper.SKIP: self.payment_instructions = payment_instructions if currency is not APIHelper.SKIP: @@ -463,7 +464,7 @@ def from_dictionary(cls, status = dictionary.get("status") if dictionary.get("status") else APIHelper.SKIP role = dictionary.get("role") if dictionary.get("role") else APIHelper.SKIP parent_invoice_id = dictionary.get("parent_invoice_id") if "parent_invoice_id" in dictionary.keys() else APIHelper.SKIP - collection_method = dictionary.get("collection_method") if dictionary.get("collection_method") else 'automatic' + collection_method = dictionary.get("collection_method") if dictionary.get("collection_method") else APIHelper.SKIP payment_instructions = dictionary.get("payment_instructions") if dictionary.get("payment_instructions") else APIHelper.SKIP currency = dictionary.get("currency") if dictionary.get("currency") else APIHelper.SKIP consolidation_level = dictionary.get("consolidation_level") if dictionary.get("consolidation_level") else APIHelper.SKIP diff --git a/advancedbilling/models/invoice_event.py b/advancedbilling/models/invoice_event.py deleted file mode 100644 index 1ab5f58a..00000000 --- a/advancedbilling/models/invoice_event.py +++ /dev/null @@ -1,112 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper -from advancedbilling.models.invoice import Invoice - - -class InvoiceEvent(object): - - """Implementation of the 'Invoice Event' model. - - TODO: type model description here. - - Attributes: - id (long|int): TODO: type description here. - event_type (InvoiceEventType): Invoice Event Type - event_data (ApplyCreditNoteEventData | ApplyDebitNoteEventData | - ApplyPaymentEventData | ChangeInvoiceCollectionMethodEventData | - IssueInvoiceEventData | RefundInvoiceEventData | - RemovePaymentEventData | VoidInvoiceEventData | - VoidRemainderEventData | Invoice | ChangeInvoiceStatusEventData | - FailedPaymentEventData | DebitNote | CreditNote | - ChangeChargebackStatusEventData | None): The event data is the - data that, when combined with the command, results in the output - invoice found in the invoice field. - timestamp (datetime): TODO: type description here. - invoice (Invoice): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "id": 'id', - "event_type": 'event_type', - "event_data": 'event_data', - "timestamp": 'timestamp', - "invoice": 'invoice' - } - - _optionals = [ - 'id', - 'event_type', - 'event_data', - 'timestamp', - 'invoice', - ] - - def __init__(self, - id=APIHelper.SKIP, - event_type=APIHelper.SKIP, - event_data=APIHelper.SKIP, - timestamp=APIHelper.SKIP, - invoice=APIHelper.SKIP, - additional_properties={}): - """Constructor for the InvoiceEvent class""" - - # Initialize members of the class - if id is not APIHelper.SKIP: - self.id = id - if event_type is not APIHelper.SKIP: - self.event_type = event_type - if event_data is not APIHelper.SKIP: - self.event_data = event_data - if timestamp is not APIHelper.SKIP: - self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None - if invoice is not APIHelper.SKIP: - self.invoice = invoice - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp - - if dictionary is None: - return None - - # Extract variables from the dictionary - id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP - event_type = dictionary.get("event_type") if dictionary.get("event_type") else APIHelper.SKIP - event_data = APIHelper.deserialize_union_type(UnionTypeLookUp.get('InvoiceEventEventData'), dictionary.get('event_data'), False) if dictionary.get('event_data') is not None else APIHelper.SKIP - timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else APIHelper.SKIP - invoice = Invoice.from_dictionary(dictionary.get('invoice')) if 'invoice' 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(id, - event_type, - event_data, - timestamp, - invoice, - dictionary) diff --git a/advancedbilling/models/invoice_event_data.py b/advancedbilling/models/invoice_event_data.py deleted file mode 100644 index e23fe95a..00000000 --- a/advancedbilling/models/invoice_event_data.py +++ /dev/null @@ -1,905 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -import dateutil.parser - -from advancedbilling.api_helper import APIHelper -from advancedbilling.models.applied_credit_note_data import AppliedCreditNoteData -from advancedbilling.models.billing_address import BillingAddress -from advancedbilling.models.credit_note_1 import CreditNote1 -from advancedbilling.models.credit_note_application import CreditNoteApplication -from advancedbilling.models.invoice_credit import InvoiceCredit -from advancedbilling.models.invoice_custom_field import InvoiceCustomField -from advancedbilling.models.invoice_customer import InvoiceCustomer -from advancedbilling.models.invoice_discount import InvoiceDiscount -from advancedbilling.models.invoice_display_settings import InvoiceDisplaySettings -from advancedbilling.models.invoice_line_item_1 import InvoiceLineItem1 -from advancedbilling.models.invoice_payer import InvoicePayer -from advancedbilling.models.invoice_payment import InvoicePayment -from advancedbilling.models.invoice_previous_balance import InvoicePreviousBalance -from advancedbilling.models.invoice_refund import InvoiceRefund -from advancedbilling.models.invoice_seller import InvoiceSeller -from advancedbilling.models.invoice_tax import InvoiceTax -from advancedbilling.models.origin_invoice import OriginInvoice -from advancedbilling.models.shipping_address import ShippingAddress - - -class InvoiceEventData(object): - - """Implementation of the 'Invoice Event Data' model. - - The event data is the data that, when combined with the command, results - in the output invoice found in the invoice field. - - Attributes: - uid (str): Unique identifier for the credit note application. It is - generated automatically by Chargify and has the prefix "cdt_" - followed by alphanumeric characters. - credit_note_number (str): A unique, identifying string that appears on - the credit note and in places it is referenced. - credit_note_uid (str): Unique identifier for the credit note. It is - generated automatically by Chargify and has the prefix "cn_" - followed by alphanumeric characters. - original_amount (str): The full, original amount of the credit note. - applied_amount (str): The amount of the credit note applied to - invoice. - transaction_time (datetime): The time the credit note was applied, in - ISO 8601 format, i.e. "2019-06-07T17:20:06Z" - memo (str): The credit note memo. - role (InvoiceRole1): The role of the credit note (e.g. 'general') - consolidated_invoice (bool): Shows whether it was applied to - consolidated invoice or not - applied_credit_notes (List[AppliedCreditNoteData]): List of credit - notes applied to children invoices (if consolidated invoice) - debit_note_number (str): A unique, identifying string that appears on - the debit note and in places it is referenced. - debit_note_uid (str): Unique identifier for the debit note. It is - generated automatically by Chargify and has the prefix "db_" - followed by alphanumeric characters. - consolidation_level (InvoiceConsolidationLevel): Consolidation level - of the invoice, which is applicable to invoice consolidation. It - will hold one of the following values: * "none": A normal invoice - with no consolidation. * "child": An invoice segment which has - been combined into a consolidated invoice. * "parent": A - consolidated invoice, whose contents are composed of invoice - segments. "Parent" invoices do not have lines of their own, but - they have subtotals and totals which aggregate the member invoice - segments. See also the [invoice consolidation - documentation](https://chargify.zendesk.com/hc/en-us/articles/44077 - 46391835). - payment_method (PaymentMethodApplePay | PaymentMethodBankAccount | - PaymentMethodCreditCard | PaymentMethodExternal | - PaymentMethodPaypal | None): A nested data structure detailing the - method of payment - transaction_id (int): The Chargify id of the original payment - parent_invoice_number (int): For invoices with `consolidation_level` - of `child`, this specifies the number of the parent (consolidated) - invoice. - remaining_prepayment_amount (str): TODO: type description here. - prepayment (bool): The flag that shows whether the original payment - was a prepayment or not - external (bool): TODO: type description here. - from_collection_method (str): The previous collection method of the - invoice. - to_collection_method (str): The new collection method of the invoice. - from_status (object): TODO: type description here. - to_status (object): TODO: type description here. - due_amount (str): Amount due on the invoice, which is `total_amount - - credit_amount - paid_amount`. - total_amount (str): The invoice total, which is `subtotal_amount - - discount_amount + tax_amount`.' - apply_credit (bool): If true, credit was created and applied it to the - invoice. - credit_note_attributes (CreditNote1): TODO: type description here. - payment_id (int): The ID of the payment transaction to be refunded. - refund_amount (str): The amount of the refund. - refund_id (int): The ID of the refund transaction. - is_advance_invoice (bool): If true, the invoice is an advance - invoice. - reason (str): The reason for the void. - id (long|int): TODO: type description here. - site_id (int): ID of the site to which the invoice belongs. - customer_id (int): ID of the customer to which the invoice belongs. - subscription_id (int): ID of the subscription that generated the - invoice. - number (str): A unique, identifying string that appears on the invoice - and in places the invoice is referenced. While the UID is long - and not appropriate to show to customers, the number is usually - shorter and consumable by the customer and the merchant alike. - sequence_number (int): A monotonically increasing number assigned to - invoices as they are created. This number is unique within a site - and can be used to sort and order invoices. - created_at (datetime): TODO: type description here. - updated_at (datetime): TODO: type description here. - issue_date (date): Date the invoice was issued to the customer. This - is the date that the invoice was made available for payment. The - format is `"YYYY-MM-DD"`. - due_date (date): Date the invoice is due. The format is - `"YYYY-MM-DD"`. - paid_date (date): Date the invoice became fully paid. If partial - payments are applied to the invoice, this date will not be present - until payment has been made in full. The format is - `"YYYY-MM-DD"`. - status (InvoiceStatus): The current status of the invoice. See - [Invoice - Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405 - 078794253-Introduction-to-Invoices#invoice-statuses) for more. - parent_invoice_id (int): TODO: type description here. - collection_method (CollectionMethod): The type of payment collection - to be used in the subscription. For legacy Statements Architecture - valid options are - `invoice`, `automatic`. For current - Relationship Invoicing Architecture valid options are - - `remittance`, `automatic`, `prepaid`. - payment_instructions (str): A message that is printed on the invoice - when it is marked for remittance collection. It is intended to - describe to the customer how they may make payment, and is - configured by the merchant. - currency (str): The ISO 4217 currency code (3 character string) - representing the currency of invoice transaction. - parent_invoice_uid (str): For invoices with `consolidation_level` of - `child`, this specifies the UID of the parent (consolidated) - invoice. - subscription_group_id (int): TODO: type description here. - group_primary_subscription_id (int): For invoices with - `consolidation_level` of `parent`, this specifies the ID of the - subscription which was the primary subscription of the - subscription group that generated the invoice. - product_name (str): The name of the product subscribed when the - invoice was generated. - product_family_name (str): The name of the product family subscribed - when the invoice was generated. - seller (InvoiceSeller): Information about the seller (merchant) listed - on the masthead of the invoice. - customer (InvoiceCustomer): Information about the customer who is - owner or recipient the invoiced subscription. - payer (InvoicePayer): TODO: type description here. - recipient_emails (List[str]): TODO: type description here. - net_terms (int): TODO: type description here. - billing_address (BillingAddress): TODO: type description here. - shipping_address (ShippingAddress): TODO: type description here. - subtotal_amount (str): Subtotal of the invoice, which is the sum of - all line items before discounts or taxes. - discount_amount (str): Total discount applied to the invoice. - tax_amount (str): Total tax on the invoice. - credit_amount (str): The amount of credit (from credit notes) applied - to this invoice. Credits offset the amount due from the - customer. - paid_amount (str): The amount paid on the invoice by the customer. - line_items (List[InvoiceLineItem1]): Line items on the invoice. - discounts (List[InvoiceDiscount]): TODO: type description here. - taxes (List[InvoiceTax]): TODO: type description here. - credits (List[InvoiceCredit]): TODO: type description here. - refunds (List[InvoiceRefund]): TODO: type description here. - payments (List[InvoicePayment]): TODO: type description here. - custom_fields (List[InvoiceCustomField]): TODO: type description - here. - display_settings (InvoiceDisplaySettings): TODO: type description - here. - public_url (str): The public URL of the invoice - previous_balance_data (InvoicePreviousBalance): TODO: type description - here. - gateway_trans_id (str): Identifier for the transaction within the - payment gateway. - amount (str): The monetary value associated with the linked payment, - expressed in dollars. - amount_in_cents (int): The monetary value of the payment, expressed in - cents. - origin_credit_note_uid (str): Unique identifier for the connected - credit note. It is generated automatically by Chargify and has the - prefix "cn_" followed by alphanumeric characters. While the UID - is long and not appropriate to show to customers, the number is - usually shorter and consumable by the customer and the merchant - alike. - origin_credit_note_number (str): A unique, identifying string of the - connected credit note. - applied_date (date): Debit notes are applied to invoices to offset - invoiced amounts - they adjust the amount due. This field is the - date the debit note document became fully applied to the invoice. - The format is "YYYY-MM-DD". - remaining_amount (str): The amount of the credit note remaining to be - applied to invoices, which is `total_amount - applied_amount`. - applications (List[CreditNoteApplication]): TODO: type description - here. - origin_invoices (List[OriginInvoice]): An array of origin invoices for - the credit note. Learn more about [Origin Invoice from our - docs](https://chargify.zendesk.com/hc/en-us/articles/4407753036699# - origin-invoices) - chargeback_status (ChargebackStatus): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "uid": 'uid', - "credit_note_number": 'credit_note_number', - "credit_note_uid": 'credit_note_uid', - "original_amount": 'original_amount', - "applied_amount": 'applied_amount', - "transaction_time": 'transaction_time', - "memo": 'memo', - "role": 'role', - "consolidated_invoice": 'consolidated_invoice', - "applied_credit_notes": 'applied_credit_notes', - "debit_note_number": 'debit_note_number', - "debit_note_uid": 'debit_note_uid', - "consolidation_level": 'consolidation_level', - "payment_method": 'payment_method', - "transaction_id": 'transaction_id', - "parent_invoice_number": 'parent_invoice_number', - "remaining_prepayment_amount": 'remaining_prepayment_amount', - "prepayment": 'prepayment', - "external": 'external', - "from_collection_method": 'from_collection_method', - "to_collection_method": 'to_collection_method', - "from_status": 'from_status', - "to_status": 'to_status', - "due_amount": 'due_amount', - "total_amount": 'total_amount', - "apply_credit": 'apply_credit', - "credit_note_attributes": 'credit_note_attributes', - "payment_id": 'payment_id', - "refund_amount": 'refund_amount', - "refund_id": 'refund_id', - "is_advance_invoice": 'is_advance_invoice', - "reason": 'reason', - "id": 'id', - "site_id": 'site_id', - "customer_id": 'customer_id', - "subscription_id": 'subscription_id', - "number": 'number', - "sequence_number": 'sequence_number', - "created_at": 'created_at', - "updated_at": 'updated_at', - "issue_date": 'issue_date', - "due_date": 'due_date', - "paid_date": 'paid_date', - "status": 'status', - "parent_invoice_id": 'parent_invoice_id', - "collection_method": 'collection_method', - "payment_instructions": 'payment_instructions', - "currency": 'currency', - "parent_invoice_uid": 'parent_invoice_uid', - "subscription_group_id": 'subscription_group_id', - "group_primary_subscription_id": 'group_primary_subscription_id', - "product_name": 'product_name', - "product_family_name": 'product_family_name', - "seller": 'seller', - "customer": 'customer', - "payer": 'payer', - "recipient_emails": 'recipient_emails', - "net_terms": 'net_terms', - "billing_address": 'billing_address', - "shipping_address": 'shipping_address', - "subtotal_amount": 'subtotal_amount', - "discount_amount": 'discount_amount', - "tax_amount": 'tax_amount', - "credit_amount": 'credit_amount', - "paid_amount": 'paid_amount', - "line_items": 'line_items', - "discounts": 'discounts', - "taxes": 'taxes', - "credits": 'credits', - "refunds": 'refunds', - "payments": 'payments', - "custom_fields": 'custom_fields', - "display_settings": 'display_settings', - "public_url": 'public_url', - "previous_balance_data": 'previous_balance_data', - "gateway_trans_id": 'gateway_trans_id', - "amount": 'amount', - "amount_in_cents": 'amount_in_cents', - "origin_credit_note_uid": 'origin_credit_note_uid', - "origin_credit_note_number": 'origin_credit_note_number', - "applied_date": 'applied_date', - "remaining_amount": 'remaining_amount', - "applications": 'applications', - "origin_invoices": 'origin_invoices', - "chargeback_status": 'chargeback_status' - } - - _optionals = [ - 'uid', - 'credit_note_number', - 'credit_note_uid', - 'original_amount', - 'applied_amount', - 'transaction_time', - 'memo', - 'role', - 'consolidated_invoice', - 'applied_credit_notes', - 'debit_note_number', - 'debit_note_uid', - 'consolidation_level', - 'payment_method', - 'transaction_id', - 'parent_invoice_number', - 'remaining_prepayment_amount', - 'prepayment', - 'external', - 'from_collection_method', - 'to_collection_method', - 'from_status', - 'to_status', - 'due_amount', - 'total_amount', - 'apply_credit', - 'credit_note_attributes', - 'payment_id', - 'refund_amount', - 'refund_id', - 'is_advance_invoice', - 'reason', - 'id', - 'site_id', - 'customer_id', - 'subscription_id', - 'number', - 'sequence_number', - 'created_at', - 'updated_at', - 'issue_date', - 'due_date', - 'paid_date', - 'status', - 'parent_invoice_id', - 'collection_method', - 'payment_instructions', - 'currency', - 'parent_invoice_uid', - 'subscription_group_id', - 'group_primary_subscription_id', - 'product_name', - 'product_family_name', - 'seller', - 'customer', - 'payer', - 'recipient_emails', - 'net_terms', - 'billing_address', - 'shipping_address', - 'subtotal_amount', - 'discount_amount', - 'tax_amount', - 'credit_amount', - 'paid_amount', - 'line_items', - 'discounts', - 'taxes', - 'credits', - 'refunds', - 'payments', - 'custom_fields', - 'display_settings', - 'public_url', - 'previous_balance_data', - 'gateway_trans_id', - 'amount', - 'amount_in_cents', - 'origin_credit_note_uid', - 'origin_credit_note_number', - 'applied_date', - 'remaining_amount', - 'applications', - 'origin_invoices', - 'chargeback_status', - ] - - _nullables = [ - 'memo', - 'parent_invoice_number', - 'remaining_prepayment_amount', - 'paid_date', - 'parent_invoice_id', - 'parent_invoice_uid', - 'subscription_group_id', - 'group_primary_subscription_id', - ] - - def __init__(self, - uid=APIHelper.SKIP, - credit_note_number=APIHelper.SKIP, - credit_note_uid=APIHelper.SKIP, - original_amount=APIHelper.SKIP, - applied_amount=APIHelper.SKIP, - transaction_time=APIHelper.SKIP, - memo=APIHelper.SKIP, - role=APIHelper.SKIP, - consolidated_invoice=APIHelper.SKIP, - applied_credit_notes=APIHelper.SKIP, - debit_note_number=APIHelper.SKIP, - debit_note_uid=APIHelper.SKIP, - consolidation_level=APIHelper.SKIP, - payment_method=APIHelper.SKIP, - transaction_id=APIHelper.SKIP, - parent_invoice_number=APIHelper.SKIP, - remaining_prepayment_amount=APIHelper.SKIP, - prepayment=APIHelper.SKIP, - external=APIHelper.SKIP, - from_collection_method=APIHelper.SKIP, - to_collection_method=APIHelper.SKIP, - from_status=APIHelper.SKIP, - to_status=APIHelper.SKIP, - due_amount=APIHelper.SKIP, - total_amount=APIHelper.SKIP, - apply_credit=APIHelper.SKIP, - credit_note_attributes=APIHelper.SKIP, - payment_id=APIHelper.SKIP, - refund_amount=APIHelper.SKIP, - refund_id=APIHelper.SKIP, - is_advance_invoice=APIHelper.SKIP, - reason=APIHelper.SKIP, - id=APIHelper.SKIP, - site_id=APIHelper.SKIP, - customer_id=APIHelper.SKIP, - subscription_id=APIHelper.SKIP, - number=APIHelper.SKIP, - sequence_number=APIHelper.SKIP, - created_at=APIHelper.SKIP, - updated_at=APIHelper.SKIP, - issue_date=APIHelper.SKIP, - due_date=APIHelper.SKIP, - paid_date=APIHelper.SKIP, - status=APIHelper.SKIP, - parent_invoice_id=APIHelper.SKIP, - collection_method='automatic', - payment_instructions=APIHelper.SKIP, - currency=APIHelper.SKIP, - parent_invoice_uid=APIHelper.SKIP, - subscription_group_id=APIHelper.SKIP, - group_primary_subscription_id=APIHelper.SKIP, - product_name=APIHelper.SKIP, - product_family_name=APIHelper.SKIP, - seller=APIHelper.SKIP, - customer=APIHelper.SKIP, - payer=APIHelper.SKIP, - recipient_emails=APIHelper.SKIP, - net_terms=APIHelper.SKIP, - billing_address=APIHelper.SKIP, - shipping_address=APIHelper.SKIP, - subtotal_amount=APIHelper.SKIP, - discount_amount=APIHelper.SKIP, - tax_amount=APIHelper.SKIP, - credit_amount=APIHelper.SKIP, - paid_amount=APIHelper.SKIP, - line_items=APIHelper.SKIP, - discounts=APIHelper.SKIP, - taxes=APIHelper.SKIP, - credits=APIHelper.SKIP, - refunds=APIHelper.SKIP, - payments=APIHelper.SKIP, - custom_fields=APIHelper.SKIP, - display_settings=APIHelper.SKIP, - public_url=APIHelper.SKIP, - previous_balance_data=APIHelper.SKIP, - gateway_trans_id=APIHelper.SKIP, - amount=APIHelper.SKIP, - amount_in_cents=APIHelper.SKIP, - origin_credit_note_uid=APIHelper.SKIP, - origin_credit_note_number=APIHelper.SKIP, - applied_date=APIHelper.SKIP, - remaining_amount=APIHelper.SKIP, - applications=APIHelper.SKIP, - origin_invoices=APIHelper.SKIP, - chargeback_status=APIHelper.SKIP, - additional_properties={}): - """Constructor for the InvoiceEventData class""" - - # Initialize members of the class - if uid is not APIHelper.SKIP: - self.uid = uid - if credit_note_number is not APIHelper.SKIP: - self.credit_note_number = credit_note_number - if credit_note_uid is not APIHelper.SKIP: - self.credit_note_uid = credit_note_uid - if original_amount is not APIHelper.SKIP: - self.original_amount = original_amount - if applied_amount is not APIHelper.SKIP: - self.applied_amount = applied_amount - if transaction_time is not APIHelper.SKIP: - self.transaction_time = APIHelper.apply_datetime_converter(transaction_time, APIHelper.RFC3339DateTime) if transaction_time else None - if memo is not APIHelper.SKIP: - self.memo = memo - if role is not APIHelper.SKIP: - self.role = role - if consolidated_invoice is not APIHelper.SKIP: - self.consolidated_invoice = consolidated_invoice - if applied_credit_notes is not APIHelper.SKIP: - self.applied_credit_notes = applied_credit_notes - if debit_note_number is not APIHelper.SKIP: - self.debit_note_number = debit_note_number - if debit_note_uid is not APIHelper.SKIP: - self.debit_note_uid = debit_note_uid - if consolidation_level is not APIHelper.SKIP: - self.consolidation_level = consolidation_level - if payment_method is not APIHelper.SKIP: - self.payment_method = payment_method - if transaction_id is not APIHelper.SKIP: - self.transaction_id = transaction_id - if parent_invoice_number is not APIHelper.SKIP: - self.parent_invoice_number = parent_invoice_number - if remaining_prepayment_amount is not APIHelper.SKIP: - self.remaining_prepayment_amount = remaining_prepayment_amount - if prepayment is not APIHelper.SKIP: - self.prepayment = prepayment - if external is not APIHelper.SKIP: - self.external = external - if from_collection_method is not APIHelper.SKIP: - self.from_collection_method = from_collection_method - if to_collection_method is not APIHelper.SKIP: - self.to_collection_method = to_collection_method - if from_status is not APIHelper.SKIP: - self.from_status = from_status - if to_status is not APIHelper.SKIP: - self.to_status = to_status - if due_amount is not APIHelper.SKIP: - self.due_amount = due_amount - if total_amount is not APIHelper.SKIP: - self.total_amount = total_amount - if apply_credit is not APIHelper.SKIP: - self.apply_credit = apply_credit - if credit_note_attributes is not APIHelper.SKIP: - self.credit_note_attributes = credit_note_attributes - if payment_id is not APIHelper.SKIP: - self.payment_id = payment_id - if refund_amount is not APIHelper.SKIP: - self.refund_amount = refund_amount - if refund_id is not APIHelper.SKIP: - self.refund_id = refund_id - if is_advance_invoice is not APIHelper.SKIP: - self.is_advance_invoice = is_advance_invoice - if reason is not APIHelper.SKIP: - self.reason = reason - if id is not APIHelper.SKIP: - self.id = id - if site_id is not APIHelper.SKIP: - self.site_id = site_id - if customer_id is not APIHelper.SKIP: - self.customer_id = customer_id - if subscription_id is not APIHelper.SKIP: - self.subscription_id = subscription_id - if number is not APIHelper.SKIP: - self.number = number - if sequence_number is not APIHelper.SKIP: - self.sequence_number = sequence_number - if created_at is not APIHelper.SKIP: - self.created_at = APIHelper.apply_datetime_converter(created_at, APIHelper.RFC3339DateTime) if created_at else None - if updated_at is not APIHelper.SKIP: - self.updated_at = APIHelper.apply_datetime_converter(updated_at, APIHelper.RFC3339DateTime) if updated_at else None - if issue_date is not APIHelper.SKIP: - self.issue_date = issue_date - if due_date is not APIHelper.SKIP: - self.due_date = due_date - if paid_date is not APIHelper.SKIP: - self.paid_date = paid_date - if status is not APIHelper.SKIP: - self.status = status - if parent_invoice_id is not APIHelper.SKIP: - self.parent_invoice_id = parent_invoice_id - self.collection_method = collection_method - if payment_instructions is not APIHelper.SKIP: - self.payment_instructions = payment_instructions - if currency is not APIHelper.SKIP: - self.currency = currency - if parent_invoice_uid is not APIHelper.SKIP: - self.parent_invoice_uid = parent_invoice_uid - if subscription_group_id is not APIHelper.SKIP: - self.subscription_group_id = subscription_group_id - if group_primary_subscription_id is not APIHelper.SKIP: - self.group_primary_subscription_id = group_primary_subscription_id - if product_name is not APIHelper.SKIP: - self.product_name = product_name - if product_family_name is not APIHelper.SKIP: - self.product_family_name = product_family_name - if seller is not APIHelper.SKIP: - self.seller = seller - if customer is not APIHelper.SKIP: - self.customer = customer - if payer is not APIHelper.SKIP: - self.payer = payer - if recipient_emails is not APIHelper.SKIP: - self.recipient_emails = recipient_emails - if net_terms is not APIHelper.SKIP: - self.net_terms = net_terms - if billing_address is not APIHelper.SKIP: - self.billing_address = billing_address - if shipping_address is not APIHelper.SKIP: - self.shipping_address = shipping_address - if subtotal_amount is not APIHelper.SKIP: - self.subtotal_amount = subtotal_amount - if discount_amount is not APIHelper.SKIP: - self.discount_amount = discount_amount - if tax_amount is not APIHelper.SKIP: - self.tax_amount = tax_amount - if credit_amount is not APIHelper.SKIP: - self.credit_amount = credit_amount - if paid_amount is not APIHelper.SKIP: - self.paid_amount = paid_amount - if line_items is not APIHelper.SKIP: - self.line_items = line_items - if discounts is not APIHelper.SKIP: - self.discounts = discounts - if taxes is not APIHelper.SKIP: - self.taxes = taxes - if credits is not APIHelper.SKIP: - self.credits = credits - if refunds is not APIHelper.SKIP: - self.refunds = refunds - if payments is not APIHelper.SKIP: - self.payments = payments - if custom_fields is not APIHelper.SKIP: - self.custom_fields = custom_fields - if display_settings is not APIHelper.SKIP: - self.display_settings = display_settings - if public_url is not APIHelper.SKIP: - self.public_url = public_url - if previous_balance_data is not APIHelper.SKIP: - self.previous_balance_data = previous_balance_data - if gateway_trans_id is not APIHelper.SKIP: - self.gateway_trans_id = gateway_trans_id - if amount is not APIHelper.SKIP: - self.amount = amount - if amount_in_cents is not APIHelper.SKIP: - self.amount_in_cents = amount_in_cents - if origin_credit_note_uid is not APIHelper.SKIP: - self.origin_credit_note_uid = origin_credit_note_uid - if origin_credit_note_number is not APIHelper.SKIP: - self.origin_credit_note_number = origin_credit_note_number - if applied_date is not APIHelper.SKIP: - self.applied_date = applied_date - if remaining_amount is not APIHelper.SKIP: - self.remaining_amount = remaining_amount - if applications is not APIHelper.SKIP: - self.applications = applications - if origin_invoices is not APIHelper.SKIP: - self.origin_invoices = origin_invoices - if chargeback_status is not APIHelper.SKIP: - self.chargeback_status = chargeback_status - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp - - if dictionary is None: - return None - - # Extract variables from the dictionary - uid = dictionary.get("uid") if dictionary.get("uid") else APIHelper.SKIP - credit_note_number = dictionary.get("credit_note_number") if dictionary.get("credit_note_number") else APIHelper.SKIP - credit_note_uid = dictionary.get("credit_note_uid") if dictionary.get("credit_note_uid") else APIHelper.SKIP - original_amount = dictionary.get("original_amount") if dictionary.get("original_amount") else APIHelper.SKIP - applied_amount = dictionary.get("applied_amount") if dictionary.get("applied_amount") else APIHelper.SKIP - transaction_time = APIHelper.RFC3339DateTime.from_value(dictionary.get("transaction_time")).datetime if dictionary.get("transaction_time") else APIHelper.SKIP - memo = dictionary.get("memo") if "memo" in dictionary.keys() else APIHelper.SKIP - role = dictionary.get("role") if dictionary.get("role") else APIHelper.SKIP - consolidated_invoice = dictionary.get("consolidated_invoice") if "consolidated_invoice" in dictionary.keys() else APIHelper.SKIP - applied_credit_notes = None - if dictionary.get('applied_credit_notes') is not None: - applied_credit_notes = [AppliedCreditNoteData.from_dictionary(x) for x in dictionary.get('applied_credit_notes')] - else: - applied_credit_notes = APIHelper.SKIP - debit_note_number = dictionary.get("debit_note_number") if dictionary.get("debit_note_number") else APIHelper.SKIP - debit_note_uid = dictionary.get("debit_note_uid") if dictionary.get("debit_note_uid") else APIHelper.SKIP - consolidation_level = dictionary.get("consolidation_level") if dictionary.get("consolidation_level") else APIHelper.SKIP - payment_method = APIHelper.deserialize_union_type(UnionTypeLookUp.get('InvoiceEventDataPaymentMethod'), dictionary.get('payment_method'), False) if dictionary.get('payment_method') is not None else APIHelper.SKIP - transaction_id = dictionary.get("transaction_id") if dictionary.get("transaction_id") else APIHelper.SKIP - parent_invoice_number = dictionary.get("parent_invoice_number") if "parent_invoice_number" in dictionary.keys() else APIHelper.SKIP - remaining_prepayment_amount = dictionary.get("remaining_prepayment_amount") if "remaining_prepayment_amount" in dictionary.keys() else APIHelper.SKIP - prepayment = dictionary.get("prepayment") if "prepayment" in dictionary.keys() else APIHelper.SKIP - external = dictionary.get("external") if "external" in dictionary.keys() else APIHelper.SKIP - from_collection_method = dictionary.get("from_collection_method") if dictionary.get("from_collection_method") else APIHelper.SKIP - to_collection_method = dictionary.get("to_collection_method") if dictionary.get("to_collection_method") else APIHelper.SKIP - from_status = dictionary.get("from_status") if dictionary.get("from_status") else APIHelper.SKIP - to_status = dictionary.get("to_status") if dictionary.get("to_status") else APIHelper.SKIP - due_amount = dictionary.get("due_amount") if dictionary.get("due_amount") else APIHelper.SKIP - total_amount = dictionary.get("total_amount") if dictionary.get("total_amount") else APIHelper.SKIP - apply_credit = dictionary.get("apply_credit") if "apply_credit" in dictionary.keys() else APIHelper.SKIP - credit_note_attributes = CreditNote1.from_dictionary(dictionary.get('credit_note_attributes')) if 'credit_note_attributes' in dictionary.keys() else APIHelper.SKIP - payment_id = dictionary.get("payment_id") if dictionary.get("payment_id") else APIHelper.SKIP - refund_amount = dictionary.get("refund_amount") if dictionary.get("refund_amount") else APIHelper.SKIP - refund_id = dictionary.get("refund_id") if dictionary.get("refund_id") else APIHelper.SKIP - is_advance_invoice = dictionary.get("is_advance_invoice") if "is_advance_invoice" in dictionary.keys() else APIHelper.SKIP - reason = dictionary.get("reason") if dictionary.get("reason") else APIHelper.SKIP - id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP - site_id = dictionary.get("site_id") if dictionary.get("site_id") else APIHelper.SKIP - customer_id = dictionary.get("customer_id") if dictionary.get("customer_id") else APIHelper.SKIP - subscription_id = dictionary.get("subscription_id") if dictionary.get("subscription_id") else APIHelper.SKIP - number = dictionary.get("number") if dictionary.get("number") else APIHelper.SKIP - sequence_number = dictionary.get("sequence_number") if dictionary.get("sequence_number") else APIHelper.SKIP - created_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("created_at")).datetime if dictionary.get("created_at") else APIHelper.SKIP - updated_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("updated_at")).datetime if dictionary.get("updated_at") else APIHelper.SKIP - issue_date = dateutil.parser.parse(dictionary.get('issue_date')).date() if dictionary.get('issue_date') else APIHelper.SKIP - due_date = dateutil.parser.parse(dictionary.get('due_date')).date() if dictionary.get('due_date') else APIHelper.SKIP - if 'paid_date' in dictionary.keys(): - paid_date = dateutil.parser.parse(dictionary.get('paid_date')).date() if dictionary.get('paid_date') else None - else: - paid_date = APIHelper.SKIP - status = dictionary.get("status") if dictionary.get("status") else APIHelper.SKIP - parent_invoice_id = dictionary.get("parent_invoice_id") if "parent_invoice_id" in dictionary.keys() else APIHelper.SKIP - collection_method = dictionary.get("collection_method") if dictionary.get("collection_method") else 'automatic' - payment_instructions = dictionary.get("payment_instructions") if dictionary.get("payment_instructions") else APIHelper.SKIP - currency = dictionary.get("currency") if dictionary.get("currency") else APIHelper.SKIP - parent_invoice_uid = dictionary.get("parent_invoice_uid") if "parent_invoice_uid" in dictionary.keys() else APIHelper.SKIP - subscription_group_id = dictionary.get("subscription_group_id") if "subscription_group_id" in dictionary.keys() else APIHelper.SKIP - group_primary_subscription_id = dictionary.get("group_primary_subscription_id") if "group_primary_subscription_id" in dictionary.keys() else APIHelper.SKIP - product_name = dictionary.get("product_name") if dictionary.get("product_name") else APIHelper.SKIP - product_family_name = dictionary.get("product_family_name") if dictionary.get("product_family_name") else APIHelper.SKIP - seller = InvoiceSeller.from_dictionary(dictionary.get('seller')) if 'seller' in dictionary.keys() else APIHelper.SKIP - customer = InvoiceCustomer.from_dictionary(dictionary.get('customer')) if 'customer' in dictionary.keys() else APIHelper.SKIP - payer = InvoicePayer.from_dictionary(dictionary.get('payer')) if 'payer' in dictionary.keys() else APIHelper.SKIP - recipient_emails = dictionary.get("recipient_emails") if dictionary.get("recipient_emails") else APIHelper.SKIP - net_terms = dictionary.get("net_terms") if dictionary.get("net_terms") else APIHelper.SKIP - billing_address = BillingAddress.from_dictionary(dictionary.get('billing_address')) if 'billing_address' in dictionary.keys() else APIHelper.SKIP - shipping_address = ShippingAddress.from_dictionary(dictionary.get('shipping_address')) if 'shipping_address' in dictionary.keys() else APIHelper.SKIP - subtotal_amount = dictionary.get("subtotal_amount") if dictionary.get("subtotal_amount") else APIHelper.SKIP - discount_amount = dictionary.get("discount_amount") if dictionary.get("discount_amount") else APIHelper.SKIP - tax_amount = dictionary.get("tax_amount") if dictionary.get("tax_amount") else APIHelper.SKIP - credit_amount = dictionary.get("credit_amount") if dictionary.get("credit_amount") else APIHelper.SKIP - paid_amount = dictionary.get("paid_amount") if dictionary.get("paid_amount") else APIHelper.SKIP - line_items = None - if dictionary.get('line_items') is not None: - line_items = [InvoiceLineItem1.from_dictionary(x) for x in dictionary.get('line_items')] - else: - line_items = APIHelper.SKIP - discounts = None - if dictionary.get('discounts') is not None: - discounts = [InvoiceDiscount.from_dictionary(x) for x in dictionary.get('discounts')] - else: - discounts = APIHelper.SKIP - taxes = None - if dictionary.get('taxes') is not None: - taxes = [InvoiceTax.from_dictionary(x) for x in dictionary.get('taxes')] - else: - taxes = APIHelper.SKIP - credits = None - if dictionary.get('credits') is not None: - credits = [InvoiceCredit.from_dictionary(x) for x in dictionary.get('credits')] - else: - credits = APIHelper.SKIP - refunds = None - if dictionary.get('refunds') is not None: - refunds = [InvoiceRefund.from_dictionary(x) for x in dictionary.get('refunds')] - else: - refunds = APIHelper.SKIP - payments = None - if dictionary.get('payments') is not None: - payments = [InvoicePayment.from_dictionary(x) for x in dictionary.get('payments')] - else: - payments = APIHelper.SKIP - custom_fields = None - if dictionary.get('custom_fields') is not None: - custom_fields = [InvoiceCustomField.from_dictionary(x) for x in dictionary.get('custom_fields')] - else: - custom_fields = APIHelper.SKIP - display_settings = InvoiceDisplaySettings.from_dictionary(dictionary.get('display_settings')) if 'display_settings' in dictionary.keys() else APIHelper.SKIP - public_url = dictionary.get("public_url") if dictionary.get("public_url") else APIHelper.SKIP - previous_balance_data = InvoicePreviousBalance.from_dictionary(dictionary.get('previous_balance_data')) if 'previous_balance_data' in dictionary.keys() else APIHelper.SKIP - gateway_trans_id = dictionary.get("gateway_trans_id") if dictionary.get("gateway_trans_id") else APIHelper.SKIP - amount = dictionary.get("amount") if dictionary.get("amount") else APIHelper.SKIP - amount_in_cents = dictionary.get("amount_in_cents") if dictionary.get("amount_in_cents") else APIHelper.SKIP - origin_credit_note_uid = dictionary.get("origin_credit_note_uid") if dictionary.get("origin_credit_note_uid") else APIHelper.SKIP - origin_credit_note_number = dictionary.get("origin_credit_note_number") if dictionary.get("origin_credit_note_number") else APIHelper.SKIP - applied_date = dateutil.parser.parse(dictionary.get('applied_date')).date() if dictionary.get('applied_date') else APIHelper.SKIP - remaining_amount = dictionary.get("remaining_amount") if dictionary.get("remaining_amount") else APIHelper.SKIP - applications = None - if dictionary.get('applications') is not None: - applications = [CreditNoteApplication.from_dictionary(x) for x in dictionary.get('applications')] - else: - applications = APIHelper.SKIP - origin_invoices = None - if dictionary.get('origin_invoices') is not None: - origin_invoices = [OriginInvoice.from_dictionary(x) for x in dictionary.get('origin_invoices')] - else: - origin_invoices = APIHelper.SKIP - chargeback_status = dictionary.get("chargeback_status") if dictionary.get("chargeback_status") 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(uid, - credit_note_number, - credit_note_uid, - original_amount, - applied_amount, - transaction_time, - memo, - role, - consolidated_invoice, - applied_credit_notes, - debit_note_number, - debit_note_uid, - consolidation_level, - payment_method, - transaction_id, - parent_invoice_number, - remaining_prepayment_amount, - prepayment, - external, - from_collection_method, - to_collection_method, - from_status, - to_status, - due_amount, - total_amount, - apply_credit, - credit_note_attributes, - payment_id, - refund_amount, - refund_id, - is_advance_invoice, - reason, - id, - site_id, - customer_id, - subscription_id, - number, - sequence_number, - created_at, - updated_at, - issue_date, - due_date, - paid_date, - status, - parent_invoice_id, - collection_method, - payment_instructions, - currency, - parent_invoice_uid, - subscription_group_id, - group_primary_subscription_id, - product_name, - product_family_name, - seller, - customer, - payer, - recipient_emails, - net_terms, - billing_address, - shipping_address, - subtotal_amount, - discount_amount, - tax_amount, - credit_amount, - paid_amount, - line_items, - discounts, - taxes, - credits, - refunds, - payments, - custom_fields, - display_settings, - public_url, - previous_balance_data, - gateway_trans_id, - amount, - amount_in_cents, - origin_credit_note_uid, - origin_credit_note_number, - applied_date, - remaining_amount, - applications, - origin_invoices, - chargeback_status, - dictionary) diff --git a/advancedbilling/models/invoice_event_payment.py b/advancedbilling/models/invoice_event_payment.py deleted file mode 100644 index 7cb7bbf8..00000000 --- a/advancedbilling/models/invoice_event_payment.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper - - -class InvoiceEventPayment(object): - - """Implementation of the 'Invoice Event Payment' model. - - A nested data structure detailing the method of payment - - Attributes: - mtype (str): TODO: type description here. - masked_account_number (str): TODO: type description here. - masked_routing_number (str): TODO: type description here. - card_brand (str): TODO: type description here. - card_expiration (str): TODO: type description here. - last_four (str): TODO: type description here. - masked_card_number (str): TODO: type description here. - details (str): TODO: type description here. - kind (str): TODO: type description here. - memo (str): TODO: type description here. - email (str): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "mtype": 'type', - "masked_account_number": 'masked_account_number', - "masked_routing_number": 'masked_routing_number', - "card_brand": 'card_brand', - "card_expiration": 'card_expiration', - "last_four": 'last_four', - "masked_card_number": 'masked_card_number', - "details": 'details', - "kind": 'kind', - "memo": 'memo', - "email": 'email' - } - - _optionals = [ - 'mtype', - 'masked_account_number', - 'masked_routing_number', - 'card_brand', - 'card_expiration', - 'last_four', - 'masked_card_number', - 'details', - 'kind', - 'memo', - 'email', - ] - - _nullables = [ - 'last_four', - 'details', - 'memo', - ] - - def __init__(self, - mtype='Invoice Event Payment', - masked_account_number=APIHelper.SKIP, - masked_routing_number=APIHelper.SKIP, - card_brand=APIHelper.SKIP, - card_expiration=APIHelper.SKIP, - last_four=APIHelper.SKIP, - masked_card_number=APIHelper.SKIP, - details=APIHelper.SKIP, - kind=APIHelper.SKIP, - memo=APIHelper.SKIP, - email=APIHelper.SKIP, - additional_properties={}): - """Constructor for the InvoiceEventPayment class""" - - # Initialize members of the class - self.mtype = mtype - if masked_account_number is not APIHelper.SKIP: - self.masked_account_number = masked_account_number - if masked_routing_number is not APIHelper.SKIP: - self.masked_routing_number = masked_routing_number - if card_brand is not APIHelper.SKIP: - self.card_brand = card_brand - if card_expiration is not APIHelper.SKIP: - self.card_expiration = card_expiration - if last_four is not APIHelper.SKIP: - self.last_four = last_four - if masked_card_number is not APIHelper.SKIP: - self.masked_card_number = masked_card_number - if details is not APIHelper.SKIP: - self.details = details - if kind is not APIHelper.SKIP: - self.kind = kind - if memo is not APIHelper.SKIP: - self.memo = memo - if email is not APIHelper.SKIP: - self.email = email - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - mtype = dictionary.get("type") if dictionary.get("type") else 'Invoice Event Payment' - masked_account_number = dictionary.get("masked_account_number") if dictionary.get("masked_account_number") else APIHelper.SKIP - masked_routing_number = dictionary.get("masked_routing_number") if dictionary.get("masked_routing_number") else APIHelper.SKIP - card_brand = dictionary.get("card_brand") if dictionary.get("card_brand") else APIHelper.SKIP - card_expiration = dictionary.get("card_expiration") if dictionary.get("card_expiration") else APIHelper.SKIP - last_four = dictionary.get("last_four") if "last_four" in dictionary.keys() else APIHelper.SKIP - masked_card_number = dictionary.get("masked_card_number") if dictionary.get("masked_card_number") else APIHelper.SKIP - details = dictionary.get("details") if "details" in dictionary.keys() else APIHelper.SKIP - kind = dictionary.get("kind") if dictionary.get("kind") else APIHelper.SKIP - memo = dictionary.get("memo") if "memo" in dictionary.keys() else APIHelper.SKIP - email = dictionary.get("email") if dictionary.get("email") 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(mtype, - masked_account_number, - masked_routing_number, - card_brand, - card_expiration, - last_four, - masked_card_number, - details, - kind, - memo, - email, - dictionary) diff --git a/advancedbilling/models/invoice_event_payment_1.py b/advancedbilling/models/invoice_event_payment_1.py deleted file mode 100644 index 8ce809c4..00000000 --- a/advancedbilling/models/invoice_event_payment_1.py +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper - - -class InvoiceEventPayment1(object): - - """Implementation of the 'Invoice Event Payment1' model. - - A nested data structure detailing the method of payment - - Attributes: - mtype (str): TODO: type description here. - masked_account_number (str): TODO: type description here. - masked_routing_number (str): TODO: type description here. - card_brand (str): TODO: type description here. - card_expiration (str): TODO: type description here. - last_four (str): TODO: type description here. - masked_card_number (str): TODO: type description here. - details (str): TODO: type description here. - kind (str): TODO: type description here. - memo (str): TODO: type description here. - email (str): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "masked_account_number": 'masked_account_number', - "masked_routing_number": 'masked_routing_number', - "card_brand": 'card_brand', - "masked_card_number": 'masked_card_number', - "details": 'details', - "kind": 'kind', - "memo": 'memo', - "email": 'email', - "mtype": 'type', - "card_expiration": 'card_expiration', - "last_four": 'last_four' - } - - _optionals = [ - 'mtype', - 'card_expiration', - 'last_four', - ] - - _nullables = [ - 'last_four', - 'details', - 'memo', - ] - - def __init__(self, - masked_account_number=None, - masked_routing_number=None, - card_brand=None, - masked_card_number=None, - details=None, - kind=None, - memo=None, - email=None, - mtype='Invoice Event Payment1', - card_expiration=APIHelper.SKIP, - last_four=APIHelper.SKIP, - additional_properties={}): - """Constructor for the InvoiceEventPayment1 class""" - - # Initialize members of the class - self.mtype = mtype - self.masked_account_number = masked_account_number - self.masked_routing_number = masked_routing_number - self.card_brand = card_brand - if card_expiration is not APIHelper.SKIP: - self.card_expiration = card_expiration - if last_four is not APIHelper.SKIP: - self.last_four = last_four - self.masked_card_number = masked_card_number - self.details = details - self.kind = kind - self.memo = memo - self.email = email - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - masked_account_number = dictionary.get("masked_account_number") if dictionary.get("masked_account_number") else None - masked_routing_number = dictionary.get("masked_routing_number") if dictionary.get("masked_routing_number") else None - card_brand = dictionary.get("card_brand") if dictionary.get("card_brand") else None - masked_card_number = dictionary.get("masked_card_number") if dictionary.get("masked_card_number") else None - details = dictionary.get("details") if dictionary.get("details") else None - kind = dictionary.get("kind") if dictionary.get("kind") else None - memo = dictionary.get("memo") if dictionary.get("memo") else None - email = dictionary.get("email") if dictionary.get("email") else None - mtype = dictionary.get("type") if dictionary.get("type") else 'Invoice Event Payment1' - card_expiration = dictionary.get("card_expiration") if dictionary.get("card_expiration") else APIHelper.SKIP - last_four = dictionary.get("last_four") if "last_four" 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(masked_account_number, - masked_routing_number, - card_brand, - masked_card_number, - details, - kind, - memo, - email, - mtype, - card_expiration, - last_four, - dictionary) diff --git a/advancedbilling/models/invoice_issued.py b/advancedbilling/models/invoice_issued.py index 4df66fe5..a399c490 100644 --- a/advancedbilling/models/invoice_issued.py +++ b/advancedbilling/models/invoice_issued.py @@ -176,37 +176,73 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.uid, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.role, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.due_date, type_callable=lambda value: isinstance(value, date), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.issue_date, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.paid_date, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.due_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.paid_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.tax_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.refund_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.total_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.status_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.product_name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.consolidation_level, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.line_items, type_callable=lambda value: InvoiceLineItemEventData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.uid, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.role, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.due_date, + type_callable=lambda value: isinstance(value, date), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.issue_date, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.paid_date, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.due_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.paid_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.tax_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.refund_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.total_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.status_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.product_name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.consolidation_level, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.line_items, + type_callable=lambda value: InvoiceLineItemEventData.validate(value), + is_model_dict=True, + is_inner_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('uid'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('role'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('due_date'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('issue_date'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('paid_date'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('due_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('paid_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('tax_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('refund_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('total_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('status_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('product_name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('consolidation_level'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('line_items'), type_callable=lambda value: InvoiceLineItemEventData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('uid'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('role'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('due_date'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('issue_date'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('paid_date'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('due_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('paid_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('tax_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('refund_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('total_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('status_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('product_name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('consolidation_level'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('line_items'), + type_callable=lambda value: InvoiceLineItemEventData.validate(value), + is_model_dict=True, + is_inner_model_dict=True) diff --git a/advancedbilling/models/invoice_line_item_1.py b/advancedbilling/models/invoice_line_item_1.py deleted file mode 100644 index 4eb3b22b..00000000 --- a/advancedbilling/models/invoice_line_item_1.py +++ /dev/null @@ -1,338 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -import dateutil.parser - -from advancedbilling.api_helper import APIHelper -from advancedbilling.models.invoice_line_item_component_cost_data import InvoiceLineItemComponentCostData - - -class InvoiceLineItem1(object): - - """Implementation of the 'Invoice Line Item1' model. - - TODO: type model description here. - - Attributes: - uid (str): Unique identifier for the line item. Useful when - cross-referencing the line against individual discounts in the - `discounts` or `taxes` lists. - title (str): A short descriptor for the charge or item represented by - this line. - description (str): Detailed description for the charge or item - represented by this line. May include proration details in plain - text. Note: this string may contain line breaks that are hints - for the best display format on the invoice. - quantity (str): The quantity or count of units billed by the line - item. This is a decimal number represented as a string. (See - "About Decimal Numbers".) - unit_price (str): The price per unit for the line item. When tiered - pricing was used (i.e. not every unit was actually priced at the - same price) this will be the blended average cost per unit and the - `tiered_unit_price` field will be set to `true`. - subtotal_amount (str): The line subtotal, generally calculated as - `quantity * unit_price`. This is the canonical amount of record - for the line - when rounding differences are in play, - `subtotal_amount` takes precedence over the value derived from - `quantity * unit_price` (which may not have the proper precision - to exactly equal this amount). - discount_amount (str): The approximate discount applied to just this - line. The value is approximated in cases where rounding errors - make it difficult to apportion exactly a total discount among many - lines. Several lines may have been summed prior to applying the - discount to arrive at `discount_amount` for the invoice - backing - that out to the discount on a single line may introduce rounding - or precision errors. - tax_amount (str): The approximate tax applied to just this line. The - value is approximated in cases where rounding errors make it - difficult to apportion exactly a total tax among many lines. - Several lines may have been summed prior to applying the tax rate - to arrive at `tax_amount` for the invoice - backing that out to - the tax on a single line may introduce rounding or precision - errors. - total_amount (str): The non-canonical total amount for the line. - `subtotal_amount` is the canonical amount for a line. The invoice - `total_amount` is derived from the sum of the line - `subtotal_amount`s and discounts or taxes applied thereafter. - Therefore, due to rounding or precision errors, the sum of line - `total_amount`s may not equal the invoice `total_amount`. - tiered_unit_price (bool): When `true`, indicates that the actual - pricing scheme for the line was tiered, so the `unit_price` shown - is the blended average for all units. - period_range_start (date): Start date for the period covered by this - line. The format is `"YYYY-MM-DD"`. * For periodic charges paid - in advance, this date will match the billing date, and the end - date will be in the future. * For periodic charges paid in arrears - (e.g. metered charges), this date will be the date of the previous - billing, and the end date will be the current billing date. * For - non-periodic charges, this date and the end date will match. - period_range_end (date): End date for the period covered by this line. - The format is `"YYYY-MM-DD"`. * For periodic charges paid in - advance, this date will match the next (future) billing date. * - For periodic charges paid in arrears (e.g. metered charges), this - date will be the date of the current billing date. * For - non-periodic charges, this date and the start date will match. - transaction_id (int): TODO: type description here. - product_id (int): The ID of the product subscribed when the charge was - made. This may be set even for component charges, so true - product-only (non-component) charges will also have a nil - `component_id`. - product_version (int): The version of the product subscribed when the - charge was made. - component_id (int): The ID of the component being billed. Will be - `nil` for non-component charges. - price_point_id (int): The price point ID of the component being - billed. Will be `nil` for non-component charges. - hide (bool): TODO: type description here. - component_cost_data (InvoiceLineItemComponentCostData): TODO: type - description here. - product_price_point_id (int): The price point ID of the line item's - product - custom_item (bool): TODO: type description here. - kind (str): TODO: type description here. - billing_schedule_item_id (int): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "uid": 'uid', - "title": 'title', - "description": 'description', - "quantity": 'quantity', - "unit_price": 'unit_price', - "subtotal_amount": 'subtotal_amount', - "discount_amount": 'discount_amount', - "tax_amount": 'tax_amount', - "total_amount": 'total_amount', - "tiered_unit_price": 'tiered_unit_price', - "period_range_start": 'period_range_start', - "period_range_end": 'period_range_end', - "transaction_id": 'transaction_id', - "product_id": 'product_id', - "product_version": 'product_version', - "component_id": 'component_id', - "price_point_id": 'price_point_id', - "hide": 'hide', - "component_cost_data": 'component_cost_data', - "product_price_point_id": 'product_price_point_id', - "custom_item": 'custom_item', - "kind": 'kind', - "billing_schedule_item_id": 'billing_schedule_item_id' - } - - _optionals = [ - 'uid', - 'title', - 'description', - 'quantity', - 'unit_price', - 'subtotal_amount', - 'discount_amount', - 'tax_amount', - 'total_amount', - 'tiered_unit_price', - 'period_range_start', - 'period_range_end', - 'transaction_id', - 'product_id', - 'product_version', - 'component_id', - 'price_point_id', - 'hide', - 'component_cost_data', - 'product_price_point_id', - 'custom_item', - 'kind', - 'billing_schedule_item_id', - ] - - _nullables = [ - 'product_id', - 'product_version', - 'component_id', - 'price_point_id', - 'component_cost_data', - 'product_price_point_id', - 'billing_schedule_item_id', - ] - - def __init__(self, - uid=APIHelper.SKIP, - title=APIHelper.SKIP, - description=APIHelper.SKIP, - quantity=APIHelper.SKIP, - unit_price=APIHelper.SKIP, - subtotal_amount=APIHelper.SKIP, - discount_amount=APIHelper.SKIP, - tax_amount=APIHelper.SKIP, - total_amount=APIHelper.SKIP, - tiered_unit_price=APIHelper.SKIP, - period_range_start=APIHelper.SKIP, - period_range_end=APIHelper.SKIP, - transaction_id=APIHelper.SKIP, - product_id=APIHelper.SKIP, - product_version=APIHelper.SKIP, - component_id=APIHelper.SKIP, - price_point_id=APIHelper.SKIP, - hide=APIHelper.SKIP, - component_cost_data=APIHelper.SKIP, - product_price_point_id=APIHelper.SKIP, - custom_item=APIHelper.SKIP, - kind=APIHelper.SKIP, - billing_schedule_item_id=APIHelper.SKIP, - additional_properties={}): - """Constructor for the InvoiceLineItem1 class""" - - # Initialize members of the class - if uid is not APIHelper.SKIP: - self.uid = uid - if title is not APIHelper.SKIP: - self.title = title - if description is not APIHelper.SKIP: - self.description = description - if quantity is not APIHelper.SKIP: - self.quantity = quantity - if unit_price is not APIHelper.SKIP: - self.unit_price = unit_price - if subtotal_amount is not APIHelper.SKIP: - self.subtotal_amount = subtotal_amount - if discount_amount is not APIHelper.SKIP: - self.discount_amount = discount_amount - if tax_amount is not APIHelper.SKIP: - self.tax_amount = tax_amount - if total_amount is not APIHelper.SKIP: - self.total_amount = total_amount - if tiered_unit_price is not APIHelper.SKIP: - self.tiered_unit_price = tiered_unit_price - if period_range_start is not APIHelper.SKIP: - self.period_range_start = period_range_start - if period_range_end is not APIHelper.SKIP: - self.period_range_end = period_range_end - if transaction_id is not APIHelper.SKIP: - self.transaction_id = transaction_id - if product_id is not APIHelper.SKIP: - self.product_id = product_id - if product_version is not APIHelper.SKIP: - self.product_version = product_version - if component_id is not APIHelper.SKIP: - self.component_id = component_id - if price_point_id is not APIHelper.SKIP: - self.price_point_id = price_point_id - if hide is not APIHelper.SKIP: - self.hide = hide - if component_cost_data is not APIHelper.SKIP: - self.component_cost_data = component_cost_data - if product_price_point_id is not APIHelper.SKIP: - self.product_price_point_id = product_price_point_id - if custom_item is not APIHelper.SKIP: - self.custom_item = custom_item - if kind is not APIHelper.SKIP: - self.kind = kind - if billing_schedule_item_id is not APIHelper.SKIP: - self.billing_schedule_item_id = billing_schedule_item_id - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - uid = dictionary.get("uid") if dictionary.get("uid") else APIHelper.SKIP - title = dictionary.get("title") if dictionary.get("title") else APIHelper.SKIP - description = dictionary.get("description") if dictionary.get("description") else APIHelper.SKIP - quantity = dictionary.get("quantity") if dictionary.get("quantity") else APIHelper.SKIP - unit_price = dictionary.get("unit_price") if dictionary.get("unit_price") else APIHelper.SKIP - subtotal_amount = dictionary.get("subtotal_amount") if dictionary.get("subtotal_amount") else APIHelper.SKIP - discount_amount = dictionary.get("discount_amount") if dictionary.get("discount_amount") else APIHelper.SKIP - tax_amount = dictionary.get("tax_amount") if dictionary.get("tax_amount") else APIHelper.SKIP - total_amount = dictionary.get("total_amount") if dictionary.get("total_amount") else APIHelper.SKIP - tiered_unit_price = dictionary.get("tiered_unit_price") if "tiered_unit_price" in dictionary.keys() else APIHelper.SKIP - period_range_start = dateutil.parser.parse(dictionary.get('period_range_start')).date() if dictionary.get('period_range_start') else APIHelper.SKIP - period_range_end = dateutil.parser.parse(dictionary.get('period_range_end')).date() if dictionary.get('period_range_end') else APIHelper.SKIP - transaction_id = dictionary.get("transaction_id") if dictionary.get("transaction_id") else APIHelper.SKIP - product_id = dictionary.get("product_id") if "product_id" in dictionary.keys() else APIHelper.SKIP - product_version = dictionary.get("product_version") if "product_version" in dictionary.keys() else APIHelper.SKIP - component_id = dictionary.get("component_id") if "component_id" in dictionary.keys() else APIHelper.SKIP - price_point_id = dictionary.get("price_point_id") if "price_point_id" in dictionary.keys() else APIHelper.SKIP - hide = dictionary.get("hide") if "hide" in dictionary.keys() else APIHelper.SKIP - if 'component_cost_data' in dictionary.keys(): - component_cost_data = InvoiceLineItemComponentCostData.from_dictionary(dictionary.get('component_cost_data')) if dictionary.get('component_cost_data') else None - else: - component_cost_data = APIHelper.SKIP - product_price_point_id = dictionary.get("product_price_point_id") if "product_price_point_id" in dictionary.keys() else APIHelper.SKIP - custom_item = dictionary.get("custom_item") if "custom_item" in dictionary.keys() else APIHelper.SKIP - kind = dictionary.get("kind") if dictionary.get("kind") else APIHelper.SKIP - billing_schedule_item_id = dictionary.get("billing_schedule_item_id") if "billing_schedule_item_id" 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(uid, - title, - description, - quantity, - unit_price, - subtotal_amount, - discount_amount, - tax_amount, - total_amount, - tiered_unit_price, - period_range_start, - period_range_end, - transaction_id, - product_id, - product_version, - component_id, - price_point_id, - hide, - component_cost_data, - product_price_point_id, - custom_item, - kind, - billing_schedule_item_id, - dictionary) - - @classmethod - def validate(cls, dictionary): - """Validates dictionary against class required properties - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - boolean : if dictionary is valid contains required properties. - - """ - - if isinstance(dictionary, cls): - return True - - if not isinstance(dictionary, dict): - return False - - return True diff --git a/advancedbilling/models/invoice_role_1.py b/advancedbilling/models/invoice_role_1.py deleted file mode 100644 index 083761da..00000000 --- a/advancedbilling/models/invoice_role_1.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" - - -class InvoiceRole1(object): - - """Implementation of the 'Invoice Role1' enum. - - The role of the credit note (e.g. 'general') - - Attributes: - UNSET: TODO: type description here. - SIGNUP: TODO: type description here. - RENEWAL: TODO: type description here. - USAGE: TODO: type description here. - REACTIVATION: TODO: type description here. - PRORATION: TODO: type description here. - MIGRATION: TODO: type description here. - ADHOC: TODO: type description here. - BACKPORT: TODO: type description here. - BACKPORTBALANCERECONCILIATION: TODO: type description here. - - """ - _all_values = ['unset', 'signup', 'renewal', 'usage', 'reactivation', 'proration', 'migration', 'adhoc', 'backport', 'backport-balance-reconciliation'] - UNSET = 'unset' - - SIGNUP = 'signup' - - RENEWAL = 'renewal' - - USAGE = 'usage' - - REACTIVATION = 'reactivation' - - PRORATION = 'proration' - - MIGRATION = 'migration' - - ADHOC = 'adhoc' - - BACKPORT = 'backport' - - BACKPORTBALANCERECONCILIATION = 'backport-balance-reconciliation' - - @classmethod - def validate(cls, value): - """Validates value contains in enum - - Args: - value: the value to be validated - - Returns: - boolean : if value is valid enum values. - - """ - return value in cls._all_values - \ No newline at end of file diff --git a/advancedbilling/models/issue_invoice_event.py b/advancedbilling/models/issue_invoice_event.py new file mode 100644 index 00000000..6e790552 --- /dev/null +++ b/advancedbilling/models/issue_invoice_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType +from advancedbilling.models.issue_invoice_event_data import IssueInvoiceEventData + + +class IssueInvoiceEvent(object): + + """Implementation of the 'Issue Invoice Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (IssueInvoiceEventData): Example schema for an + `issue_invoice` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='issue_invoice', + event_data=None, + additional_properties={}): + """Constructor for the IssueInvoiceEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'issue_invoice' + event_data = IssueInvoiceEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: IssueInvoiceEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: IssueInvoiceEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/issue_invoice_event_data.py b/advancedbilling/models/issue_invoice_event_data.py index 85918389..e0243df9 100644 --- a/advancedbilling/models/issue_invoice_event_data.py +++ b/advancedbilling/models/issue_invoice_event_data.py @@ -123,17 +123,27 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.consolidation_level, type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.from_status, type_callable=lambda value: InvoiceStatus.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.to_status, type_callable=lambda value: InvoiceStatus.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.due_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.total_amount, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.consolidation_level, + type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.from_status, + type_callable=lambda value: InvoiceStatus.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.to_status, + type_callable=lambda value: InvoiceStatus.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.due_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.total_amount, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('consolidation_level'), type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('from_status'), type_callable=lambda value: InvoiceStatus.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('to_status'), type_callable=lambda value: InvoiceStatus.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('due_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('total_amount'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('consolidation_level'), + type_callable=lambda value: InvoiceConsolidationLevel.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('from_status'), + type_callable=lambda value: InvoiceStatus.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('to_status'), + type_callable=lambda value: InvoiceStatus.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('due_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('total_amount'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/item_price_point_changed.py b/advancedbilling/models/item_price_point_changed.py index 4bdd45ac..27c6ad87 100644 --- a/advancedbilling/models/item_price_point_changed.py +++ b/advancedbilling/models/item_price_point_changed.py @@ -112,19 +112,35 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.item_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.item_type, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.item_handle, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.item_name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.previous_price_point, type_callable=lambda value: ItemPricePointData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.current_price_point, type_callable=lambda value: ItemPricePointData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.item_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.item_type, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.item_handle, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.item_name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.previous_price_point, + type_callable=lambda value: ItemPricePointData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.current_price_point, + type_callable=lambda value: ItemPricePointData.validate(value), + is_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('item_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('item_type'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('item_handle'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('item_name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('previous_price_point'), type_callable=lambda value: ItemPricePointData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('current_price_point'), type_callable=lambda value: ItemPricePointData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('item_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('item_type'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('item_handle'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('item_name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('previous_price_point'), + type_callable=lambda value: ItemPricePointData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('current_price_point'), + type_callable=lambda value: ItemPricePointData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/list_invoice_events_response.py b/advancedbilling/models/list_invoice_events_response.py index 4d1f493a..8810aa4e 100644 --- a/advancedbilling/models/list_invoice_events_response.py +++ b/advancedbilling/models/list_invoice_events_response.py @@ -7,7 +7,6 @@ https://www.apimatic.io ). """ from advancedbilling.api_helper import APIHelper -from advancedbilling.models.invoice_event import InvoiceEvent class ListInvoiceEventsResponse(object): @@ -17,7 +16,13 @@ class ListInvoiceEventsResponse(object): TODO: type model description here. Attributes: - events (List[InvoiceEvent]): TODO: type description here. + events (List[ApplyCreditNoteEvent | ApplyDebitNoteEvent | + ApplyPaymentEvent | BackportInvoiceEvent | + ChangeChargebackStatusEvent | ChangeInvoiceCollectionMethodEvent | + ChangeInvoiceStatusEvent | CreateCreditNoteEvent | + CreateDebitNoteEvent | FailedPaymentEvent | IssueInvoiceEvent | + RefundInvoiceEvent | RemovePaymentEvent | VoidInvoiceEvent | + VoidRemainderEvent] | None): TODO: type description here. page (int): TODO: type description here. per_page (int): TODO: type description here. total_pages (int): TODO: type description here. @@ -74,16 +79,13 @@ def from_dictionary(cls, object: An instance of this structure class. """ + from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp if dictionary is None: return None # Extract variables from the dictionary - events = None - if dictionary.get('events') is not None: - events = [InvoiceEvent.from_dictionary(x) for x in dictionary.get('events')] - else: - events = APIHelper.SKIP + events = APIHelper.deserialize_union_type(UnionTypeLookUp.get('Invoice-Event'), dictionary.get('events'), False) if dictionary.get('events') is not None else APIHelper.SKIP page = dictionary.get("page") if dictionary.get("page") else APIHelper.SKIP per_page = dictionary.get("per_page") if dictionary.get("per_page") else APIHelper.SKIP total_pages = dictionary.get("total_pages") if dictionary.get("total_pages") else APIHelper.SKIP diff --git a/advancedbilling/models/metered_usage.py b/advancedbilling/models/metered_usage.py index 346de398..33a109c2 100644 --- a/advancedbilling/models/metered_usage.py +++ b/advancedbilling/models/metered_usage.py @@ -109,19 +109,31 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.previous_unit_balance, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.new_unit_balance, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.usage_quantity, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.component_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.component_handle, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.previous_unit_balance, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.new_unit_balance, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.usage_quantity, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.component_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.component_handle, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('previous_unit_balance'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('new_unit_balance'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('usage_quantity'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('component_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('component_handle'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('previous_unit_balance'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('new_unit_balance'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('usage_quantity'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('component_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('component_handle'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/overage_pricing.py b/advancedbilling/models/overage_pricing.py index 18bf2988..294e97ff 100644 --- a/advancedbilling/models/overage_pricing.py +++ b/advancedbilling/models/overage_pricing.py @@ -99,9 +99,11 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.pricing_scheme, type_callable=lambda value: PricingScheme.validate(value)) + return APIHelper.is_valid_type(value=dictionary.pricing_scheme, + type_callable=lambda value: PricingScheme.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('pricing_scheme'), type_callable=lambda value: PricingScheme.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('pricing_scheme'), + type_callable=lambda value: PricingScheme.validate(value)) diff --git a/advancedbilling/models/payment_collection_method_changed.py b/advancedbilling/models/payment_collection_method_changed.py index e2a9a4ae..c57163df 100644 --- a/advancedbilling/models/payment_collection_method_changed.py +++ b/advancedbilling/models/payment_collection_method_changed.py @@ -85,11 +85,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.previous_value, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.current_value, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.previous_value, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.current_value, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('previous_value'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('current_value'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('previous_value'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('current_value'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/payment_method_apple_pay.py b/advancedbilling/models/payment_method_apple_pay.py index 2ef1fe40..0129d1d2 100644 --- a/advancedbilling/models/payment_method_apple_pay.py +++ b/advancedbilling/models/payment_method_apple_pay.py @@ -80,9 +80,11 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.mtype, type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.mtype, + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('type'), type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('type'), + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) diff --git a/advancedbilling/models/payment_method_bank_account.py b/advancedbilling/models/payment_method_bank_account.py index 4e574461..39accbd4 100644 --- a/advancedbilling/models/payment_method_bank_account.py +++ b/advancedbilling/models/payment_method_bank_account.py @@ -92,13 +92,19 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.masked_account_number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.masked_routing_number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.mtype, type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.masked_account_number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.masked_routing_number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.mtype, + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('masked_account_number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('masked_routing_number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('type'), type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('masked_account_number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('masked_routing_number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('type'), + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) diff --git a/advancedbilling/models/payment_method_credit_card.py b/advancedbilling/models/payment_method_credit_card.py index 36ac70ad..bfaed93d 100644 --- a/advancedbilling/models/payment_method_credit_card.py +++ b/advancedbilling/models/payment_method_credit_card.py @@ -115,13 +115,19 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.card_brand, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.masked_card_number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.mtype, type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.card_brand, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.masked_card_number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.mtype, + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('card_brand'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('masked_card_number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('type'), type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('card_brand'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('masked_card_number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('type'), + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) diff --git a/advancedbilling/models/payment_method_external.py b/advancedbilling/models/payment_method_external.py index 32616810..be707e91 100644 --- a/advancedbilling/models/payment_method_external.py +++ b/advancedbilling/models/payment_method_external.py @@ -103,15 +103,27 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.details, type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.kind, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.mtype, type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.details, + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.kind, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.mtype, + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('details'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('kind'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('type'), type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('details'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('kind'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('type'), + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) diff --git a/advancedbilling/models/payment_method_paypal.py b/advancedbilling/models/payment_method_paypal.py index 430683e4..4c1bb678 100644 --- a/advancedbilling/models/payment_method_paypal.py +++ b/advancedbilling/models/payment_method_paypal.py @@ -86,11 +86,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.email, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.mtype, type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.email, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.mtype, + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('email'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('type'), type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('email'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('type'), + type_callable=lambda value: InvoiceEventPaymentMethod.validate(value)) diff --git a/advancedbilling/models/payment_related_events.py b/advancedbilling/models/payment_related_events.py index 4919f42b..6db16f5b 100644 --- a/advancedbilling/models/payment_related_events.py +++ b/advancedbilling/models/payment_related_events.py @@ -85,11 +85,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.product_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.account_transaction_id, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.product_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.account_transaction_id, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('product_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('account_transaction_id'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('product_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('account_transaction_id'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/pending_cancellation_change.py b/advancedbilling/models/pending_cancellation_change.py index ed4192b5..7b33c910 100644 --- a/advancedbilling/models/pending_cancellation_change.py +++ b/advancedbilling/models/pending_cancellation_change.py @@ -85,11 +85,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.cancellation_state, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.cancels_at, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) + return APIHelper.is_valid_type(value=dictionary.cancellation_state, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.cancels_at, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('cancellation_state'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('cancels_at'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('cancellation_state'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('cancels_at'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/prepaid_subscription_balance_changed.py b/advancedbilling/models/prepaid_subscription_balance_changed.py index 5a12b387..44b1a6cb 100644 --- a/advancedbilling/models/prepaid_subscription_balance_changed.py +++ b/advancedbilling/models/prepaid_subscription_balance_changed.py @@ -100,15 +100,23 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.reason, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.current_account_balance_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.prepayment_account_balance_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.current_usage_amount_in_cents, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.reason, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.current_account_balance_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.prepayment_account_balance_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.current_usage_amount_in_cents, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('reason'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('current_account_balance_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('prepayment_account_balance_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('current_usage_amount_in_cents'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('reason'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('current_account_balance_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('prepayment_account_balance_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('current_usage_amount_in_cents'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/prepaid_usage.py b/advancedbilling/models/prepaid_usage.py index 6cdf9460..7d22b065 100644 --- a/advancedbilling/models/prepaid_usage.py +++ b/advancedbilling/models/prepaid_usage.py @@ -137,27 +137,51 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.previous_unit_balance, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.previous_overage_unit_balance, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.new_unit_balance, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.new_overage_unit_balance, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.usage_quantity, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.overage_usage_quantity, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.component_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.component_handle, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.allocation_details, type_callable=lambda value: PrepaidUsageAllocationDetail.validate(value)) + return APIHelper.is_valid_type(value=dictionary.previous_unit_balance, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.previous_overage_unit_balance, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.new_unit_balance, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.new_overage_unit_balance, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.usage_quantity, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.overage_usage_quantity, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.component_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.component_handle, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.allocation_details, + type_callable=lambda value: PrepaidUsageAllocationDetail.validate(value), + is_model_dict=True, + is_inner_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('previous_unit_balance'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('previous_overage_unit_balance'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('new_unit_balance'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('new_overage_unit_balance'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('usage_quantity'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('overage_usage_quantity'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('component_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('component_handle'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('allocation_details'), type_callable=lambda value: PrepaidUsageAllocationDetail.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('previous_unit_balance'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('previous_overage_unit_balance'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('new_unit_balance'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('new_overage_unit_balance'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('usage_quantity'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('overage_usage_quantity'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('component_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('component_handle'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('allocation_details'), + type_callable=lambda value: PrepaidUsageAllocationDetail.validate(value), + is_model_dict=True, + is_inner_model_dict=True) diff --git a/advancedbilling/models/prepayment_account_balance_changed.py b/advancedbilling/models/prepayment_account_balance_changed.py index 158490c9..2c45fd98 100644 --- a/advancedbilling/models/prepayment_account_balance_changed.py +++ b/advancedbilling/models/prepayment_account_balance_changed.py @@ -99,15 +99,23 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.reason, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.prepayment_account_balance_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.prepayment_balance_change_in_cents, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.currency_code, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.reason, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.prepayment_account_balance_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.prepayment_balance_change_in_cents, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.currency_code, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('reason'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('prepayment_account_balance_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('prepayment_balance_change_in_cents'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('currency_code'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('reason'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('prepayment_account_balance_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('prepayment_balance_change_in_cents'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('currency_code'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/price_point.py b/advancedbilling/models/price_point.py deleted file mode 100644 index af5bbcf4..00000000 --- a/advancedbilling/models/price_point.py +++ /dev/null @@ -1,187 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper -from advancedbilling.models.overage_pricing import OveragePricing -from advancedbilling.models.price import Price - - -class PricePoint(object): - - """Implementation of the 'PricePoint' model. - - TODO: type model description here. - - Attributes: - name (str): TODO: type description here. - handle (str): TODO: type description here. - pricing_scheme (PricingScheme): The identifier for the pricing scheme. - See [Product - Components](https://help.chargify.com/products/product-components.h - tml) for an overview of pricing schemes. - prices (List[Price]): TODO: type description here. - use_site_exchange_rate (bool): Whether to use the site level exchange - rate or define your own prices for each currency if you have - multiple currencies defined on the site. - tax_included (bool): Whether or not the price point includes tax - interval (int): The numerical interval. i.e. an interval of ‘30’ - coupled with an interval_unit of day would mean this price point - would renew every 30 days. This property is only available for - sites with Multifrequency enabled. - interval_unit (IntervalUnit): A string representing the interval unit - for this price point, either month or day. This property is only - available for sites with Multifrequency enabled. - overage_pricing (OveragePricing): TODO: type description here. - rollover_prepaid_remainder (bool): Boolean which controls whether or - not remaining units should be rolled over to the next period - renew_prepaid_allocation (bool): Boolean which controls whether or not - the allocated quantity should be renewed at the beginning of each - period - expiration_interval (float): (only for prepaid usage components where - rollover_prepaid_remainder is true) The number of - `expiration_interval_unit`s after which rollover amounts should - expire - expiration_interval_unit (IntervalUnit): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "name": 'name', - "handle": 'handle', - "pricing_scheme": 'pricing_scheme', - "prices": 'prices', - "use_site_exchange_rate": 'use_site_exchange_rate', - "tax_included": 'tax_included', - "interval": 'interval', - "interval_unit": 'interval_unit', - "overage_pricing": 'overage_pricing', - "rollover_prepaid_remainder": 'rollover_prepaid_remainder', - "renew_prepaid_allocation": 'renew_prepaid_allocation', - "expiration_interval": 'expiration_interval', - "expiration_interval_unit": 'expiration_interval_unit' - } - - _optionals = [ - 'name', - 'handle', - 'pricing_scheme', - 'prices', - 'use_site_exchange_rate', - 'tax_included', - 'interval', - 'interval_unit', - 'overage_pricing', - 'rollover_prepaid_remainder', - 'renew_prepaid_allocation', - 'expiration_interval', - 'expiration_interval_unit', - ] - - def __init__(self, - name=APIHelper.SKIP, - handle=APIHelper.SKIP, - pricing_scheme=APIHelper.SKIP, - prices=APIHelper.SKIP, - use_site_exchange_rate=True, - tax_included=APIHelper.SKIP, - interval=APIHelper.SKIP, - interval_unit=APIHelper.SKIP, - overage_pricing=APIHelper.SKIP, - rollover_prepaid_remainder=APIHelper.SKIP, - renew_prepaid_allocation=APIHelper.SKIP, - expiration_interval=APIHelper.SKIP, - expiration_interval_unit=APIHelper.SKIP, - additional_properties={}): - """Constructor for the PricePoint class""" - - # Initialize members of the class - if name is not APIHelper.SKIP: - self.name = name - if handle is not APIHelper.SKIP: - self.handle = handle - if pricing_scheme is not APIHelper.SKIP: - self.pricing_scheme = pricing_scheme - if prices is not APIHelper.SKIP: - self.prices = prices - self.use_site_exchange_rate = use_site_exchange_rate - if tax_included is not APIHelper.SKIP: - self.tax_included = tax_included - if interval is not APIHelper.SKIP: - self.interval = interval - if interval_unit is not APIHelper.SKIP: - self.interval_unit = interval_unit - if overage_pricing is not APIHelper.SKIP: - self.overage_pricing = overage_pricing - if rollover_prepaid_remainder is not APIHelper.SKIP: - self.rollover_prepaid_remainder = rollover_prepaid_remainder - if renew_prepaid_allocation is not APIHelper.SKIP: - self.renew_prepaid_allocation = renew_prepaid_allocation - if expiration_interval is not APIHelper.SKIP: - self.expiration_interval = expiration_interval - if expiration_interval_unit is not APIHelper.SKIP: - self.expiration_interval_unit = expiration_interval_unit - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP - handle = dictionary.get("handle") if dictionary.get("handle") else APIHelper.SKIP - pricing_scheme = dictionary.get("pricing_scheme") if dictionary.get("pricing_scheme") else APIHelper.SKIP - prices = None - if dictionary.get('prices') is not None: - prices = [Price.from_dictionary(x) for x in dictionary.get('prices')] - else: - prices = APIHelper.SKIP - use_site_exchange_rate = dictionary.get("use_site_exchange_rate") if dictionary.get("use_site_exchange_rate") else True - tax_included = dictionary.get("tax_included") if "tax_included" in dictionary.keys() else APIHelper.SKIP - interval = dictionary.get("interval") if dictionary.get("interval") else APIHelper.SKIP - interval_unit = dictionary.get("interval_unit") if dictionary.get("interval_unit") else APIHelper.SKIP - overage_pricing = OveragePricing.from_dictionary(dictionary.get('overage_pricing')) if 'overage_pricing' in dictionary.keys() else APIHelper.SKIP - rollover_prepaid_remainder = dictionary.get("rollover_prepaid_remainder") if "rollover_prepaid_remainder" in dictionary.keys() else APIHelper.SKIP - renew_prepaid_allocation = dictionary.get("renew_prepaid_allocation") if "renew_prepaid_allocation" in dictionary.keys() else APIHelper.SKIP - expiration_interval = dictionary.get("expiration_interval") if dictionary.get("expiration_interval") else APIHelper.SKIP - expiration_interval_unit = dictionary.get("expiration_interval_unit") if dictionary.get("expiration_interval_unit") 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(name, - handle, - pricing_scheme, - prices, - use_site_exchange_rate, - tax_included, - interval, - interval_unit, - overage_pricing, - rollover_prepaid_remainder, - renew_prepaid_allocation, - expiration_interval, - expiration_interval_unit, - dictionary) diff --git a/advancedbilling/models/proforma_invoice.py b/advancedbilling/models/proforma_invoice.py index 5b55fa4b..17166c7e 100644 --- a/advancedbilling/models/proforma_invoice.py +++ b/advancedbilling/models/proforma_invoice.py @@ -182,7 +182,7 @@ def __init__(self, created_at=APIHelper.SKIP, delivery_date=APIHelper.SKIP, status=APIHelper.SKIP, - collection_method='automatic', + collection_method=APIHelper.SKIP, payment_instructions=APIHelper.SKIP, currency=APIHelper.SKIP, consolidation_level=APIHelper.SKIP, @@ -231,7 +231,8 @@ def __init__(self, self.delivery_date = delivery_date if status is not APIHelper.SKIP: self.status = status - self.collection_method = collection_method + if collection_method is not APIHelper.SKIP: + self.collection_method = collection_method if payment_instructions is not APIHelper.SKIP: self.payment_instructions = payment_instructions if currency is not APIHelper.SKIP: @@ -316,7 +317,7 @@ def from_dictionary(cls, created_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("created_at")).datetime if dictionary.get("created_at") else APIHelper.SKIP delivery_date = dateutil.parser.parse(dictionary.get('delivery_date')).date() if dictionary.get('delivery_date') else APIHelper.SKIP status = dictionary.get("status") if dictionary.get("status") else APIHelper.SKIP - collection_method = dictionary.get("collection_method") if dictionary.get("collection_method") else 'automatic' + collection_method = dictionary.get("collection_method") if dictionary.get("collection_method") else APIHelper.SKIP payment_instructions = dictionary.get("payment_instructions") if dictionary.get("payment_instructions") else APIHelper.SKIP currency = dictionary.get("currency") if dictionary.get("currency") else APIHelper.SKIP consolidation_level = dictionary.get("consolidation_level") if dictionary.get("consolidation_level") else APIHelper.SKIP diff --git a/advancedbilling/models/proforma_invoice_issued.py b/advancedbilling/models/proforma_invoice_issued.py index 8d49a8b7..3d88071d 100644 --- a/advancedbilling/models/proforma_invoice_issued.py +++ b/advancedbilling/models/proforma_invoice_issued.py @@ -146,29 +146,55 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.uid, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.number, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.role, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.delivery_date, type_callable=lambda value: isinstance(value, date)) \ - and APIHelper.is_valid_type(value=dictionary.created_at, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ - and APIHelper.is_valid_type(value=dictionary.due_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.paid_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.tax_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.total_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.product_name, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.line_items, type_callable=lambda value: InvoiceLineItemEventData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.uid, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.number, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.role, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.delivery_date, + type_callable=lambda value: isinstance(value, date)) \ + and APIHelper.is_valid_type(value=dictionary.created_at, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.due_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.paid_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.tax_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.total_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.product_name, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.line_items, + type_callable=lambda value: InvoiceLineItemEventData.validate(value), + is_model_dict=True, + is_inner_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('uid'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('number'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('role'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('delivery_date'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('created_at'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('due_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('paid_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('tax_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('total_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('product_name'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('line_items'), type_callable=lambda value: InvoiceLineItemEventData.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('uid'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('number'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('role'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('delivery_date'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('created_at'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('due_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('paid_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('tax_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('total_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('product_name'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('line_items'), + type_callable=lambda value: InvoiceLineItemEventData.validate(value), + is_model_dict=True, + is_inner_model_dict=True) diff --git a/advancedbilling/models/refund.py b/advancedbilling/models/refund.py deleted file mode 100644 index 5a292263..00000000 --- a/advancedbilling/models/refund.py +++ /dev/null @@ -1,127 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper - - -class Refund(object): - - """Implementation of the 'Refund' model. - - TODO: type model description here. - - Attributes: - amount (str): The amount to be refunded in decimal format as a string. - Example: "10.50". Must not exceed the remaining refundable balance - of the payment. - memo (str): A description that will be attached to the refund - payment_id (int): The ID of the payment to be refunded - external (bool): Flag that marks refund as external (no money is - returned to the customer). Defaults to `false`. - apply_credit (bool): If set to true, creates credit and applies it to - an invoice. Defaults to `false`. - void_invoice (bool): If `apply_credit` set to false and refunding full - amount, if `void_invoice` set to true, invoice will be voided - after refund. Defaults to `false`. - segment_uids (List[str] | str | None): An array of segment uids to - refund or the string 'all' to indicate that all segments should be - refunded - - """ - - # Create a mapping from Model property names to API property names - _names = { - "amount": 'amount', - "memo": 'memo', - "payment_id": 'payment_id', - "external": 'external', - "apply_credit": 'apply_credit', - "void_invoice": 'void_invoice', - "segment_uids": 'segment_uids' - } - - _optionals = [ - 'amount', - 'memo', - 'payment_id', - 'external', - 'apply_credit', - 'void_invoice', - 'segment_uids', - ] - - def __init__(self, - amount=APIHelper.SKIP, - memo=APIHelper.SKIP, - payment_id=APIHelper.SKIP, - external=APIHelper.SKIP, - apply_credit=APIHelper.SKIP, - void_invoice=APIHelper.SKIP, - segment_uids=APIHelper.SKIP, - additional_properties={}): - """Constructor for the Refund class""" - - # Initialize members of the class - if amount is not APIHelper.SKIP: - self.amount = amount - if memo is not APIHelper.SKIP: - self.memo = memo - if payment_id is not APIHelper.SKIP: - self.payment_id = payment_id - if external is not APIHelper.SKIP: - self.external = external - if apply_credit is not APIHelper.SKIP: - self.apply_credit = apply_credit - if void_invoice is not APIHelper.SKIP: - self.void_invoice = void_invoice - if segment_uids is not APIHelper.SKIP: - self.segment_uids = segment_uids - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp - - if dictionary is None: - return None - - # Extract variables from the dictionary - amount = dictionary.get("amount") if dictionary.get("amount") else APIHelper.SKIP - memo = dictionary.get("memo") if dictionary.get("memo") else APIHelper.SKIP - payment_id = dictionary.get("payment_id") if dictionary.get("payment_id") else APIHelper.SKIP - external = dictionary.get("external") if "external" in dictionary.keys() else APIHelper.SKIP - apply_credit = dictionary.get("apply_credit") if "apply_credit" in dictionary.keys() else APIHelper.SKIP - void_invoice = dictionary.get("void_invoice") if "void_invoice" in dictionary.keys() else APIHelper.SKIP - segment_uids = APIHelper.deserialize_union_type(UnionTypeLookUp.get('RefundSegmentUids'), dictionary.get('segment_uids'), False) if dictionary.get('segment_uids') is not None 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(amount, - memo, - payment_id, - external, - apply_credit, - void_invoice, - segment_uids, - dictionary) diff --git a/advancedbilling/models/refund_consolidated_invoice.py b/advancedbilling/models/refund_consolidated_invoice.py index e856ad82..4d80818f 100644 --- a/advancedbilling/models/refund_consolidated_invoice.py +++ b/advancedbilling/models/refund_consolidated_invoice.py @@ -125,13 +125,17 @@ def validate(cls, dictionary): from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.payment_id, type_callable=lambda value: isinstance(value, int)) \ + return APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.payment_id, + type_callable=lambda value: isinstance(value, int)) \ and UnionTypeLookUp.get('RefundConsolidatedInvoiceSegmentUids').validate(dictionary.segment_uids).is_valid if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('payment_id'), type_callable=lambda value: isinstance(value, int)) \ + return APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('payment_id'), + type_callable=lambda value: isinstance(value, int)) \ and UnionTypeLookUp.get('RefundConsolidatedInvoiceSegmentUids').validate(dictionary.get('segment_uids')).is_valid diff --git a/advancedbilling/models/refund_invoice.py b/advancedbilling/models/refund_invoice.py index dc6af8e5..b689eb13 100644 --- a/advancedbilling/models/refund_invoice.py +++ b/advancedbilling/models/refund_invoice.py @@ -124,13 +124,19 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.payment_id, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.payment_id, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('payment_id'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('payment_id'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/refund_invoice_event.py b/advancedbilling/models/refund_invoice_event.py new file mode 100644 index 00000000..6153d730 --- /dev/null +++ b/advancedbilling/models/refund_invoice_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType +from advancedbilling.models.refund_invoice_event_data import RefundInvoiceEventData + + +class RefundInvoiceEvent(object): + + """Implementation of the 'Refund Invoice Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (RefundInvoiceEventData): Example schema for an + `refund_invoice` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='refund_invoice', + event_data=None, + additional_properties={}): + """Constructor for the RefundInvoiceEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'refund_invoice' + event_data = RefundInvoiceEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: RefundInvoiceEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: RefundInvoiceEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/refund_invoice_event_data.py b/advancedbilling/models/refund_invoice_event_data.py index 68463c29..a12b9e12 100644 --- a/advancedbilling/models/refund_invoice_event_data.py +++ b/advancedbilling/models/refund_invoice_event_data.py @@ -149,19 +149,33 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.apply_credit, type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.credit_note_attributes, type_callable=lambda value: CreditNote.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.payment_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.refund_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.refund_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.transaction_time, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) + return APIHelper.is_valid_type(value=dictionary.apply_credit, + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.credit_note_attributes, + type_callable=lambda value: CreditNote.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.payment_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.refund_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.refund_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.transaction_time, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('apply_credit'), type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.get('credit_note_attributes'), type_callable=lambda value: CreditNote.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('payment_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('refund_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('refund_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('apply_credit'), + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.get('credit_note_attributes'), + type_callable=lambda value: CreditNote.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('payment_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('refund_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('refund_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/refund_prepayment.py b/advancedbilling/models/refund_prepayment.py index 8fa95fb9..eaa61e8e 100644 --- a/advancedbilling/models/refund_prepayment.py +++ b/advancedbilling/models/refund_prepayment.py @@ -113,13 +113,19 @@ def validate(cls, dictionary): from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.amount_in_cents, type_callable=lambda value: isinstance(value, int), is_value_nullable=True) \ + return APIHelper.is_valid_type(value=dictionary.amount_in_cents, + type_callable=lambda value: isinstance(value, int), + is_value_nullable=True) \ and UnionTypeLookUp.get('RefundPrepaymentAmount').validate(dictionary.amount).is_valid \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('amount_in_cents'), type_callable=lambda value: isinstance(value, int), is_value_nullable=True) \ + return APIHelper.is_valid_type(value=dictionary.get('amount_in_cents'), + type_callable=lambda value: isinstance(value, int), + is_value_nullable=True) \ and UnionTypeLookUp.get('RefundPrepaymentAmount').validate(dictionary.get('amount')).is_valid \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/refund_success.py b/advancedbilling/models/refund_success.py index 0e1d68b7..e1b8abca 100644 --- a/advancedbilling/models/refund_success.py +++ b/advancedbilling/models/refund_success.py @@ -91,13 +91,19 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.refund_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.gateway_transaction_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.product_id, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.refund_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.gateway_transaction_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.product_id, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('refund_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('gateway_transaction_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('product_id'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('refund_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('gateway_transaction_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('product_id'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/remove_payment_event.py b/advancedbilling/models/remove_payment_event.py new file mode 100644 index 00000000..a87140c7 --- /dev/null +++ b/advancedbilling/models/remove_payment_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType +from advancedbilling.models.remove_payment_event_data import RemovePaymentEventData + + +class RemovePaymentEvent(object): + + """Implementation of the 'Remove Payment Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (RemovePaymentEventData): Example schema for an + `remove_payment` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='remove_payment', + event_data=None, + additional_properties={}): + """Constructor for the RemovePaymentEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'remove_payment' + event_data = RemovePaymentEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: RemovePaymentEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: RemovePaymentEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/remove_payment_event_data.py b/advancedbilling/models/remove_payment_event_data.py index 952310bb..438f0fc0 100644 --- a/advancedbilling/models/remove_payment_event_data.py +++ b/advancedbilling/models/remove_payment_event_data.py @@ -128,19 +128,29 @@ def validate(cls, dictionary): from advancedbilling.utilities.union_type_lookup import UnionTypeLookUp if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.transaction_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.applied_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.transaction_time, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + return APIHelper.is_valid_type(value=dictionary.transaction_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.applied_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.transaction_time, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ and UnionTypeLookUp.get('Invoice-Event-Payment').validate(dictionary.payment_method).is_valid \ - and APIHelper.is_valid_type(value=dictionary.prepayment, type_callable=lambda value: isinstance(value, bool)) + and APIHelper.is_valid_type(value=dictionary.prepayment, + type_callable=lambda value: isinstance(value, bool)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('transaction_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), type_callable=lambda value: isinstance(value, str)) \ + return APIHelper.is_valid_type(value=dictionary.get('transaction_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), + type_callable=lambda value: isinstance(value, str)) \ and UnionTypeLookUp.get('Invoice-Event-Payment').validate(dictionary.get('payment_method')).is_valid \ - and APIHelper.is_valid_type(value=dictionary.get('prepayment'), type_callable=lambda value: isinstance(value, bool)) + and APIHelper.is_valid_type(value=dictionary.get('prepayment'), + type_callable=lambda value: isinstance(value, bool)) diff --git a/advancedbilling/models/seller.py b/advancedbilling/models/seller.py deleted file mode 100644 index 54c844b4..00000000 --- a/advancedbilling/models/seller.py +++ /dev/null @@ -1,121 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper -from advancedbilling.models.invoice_address import InvoiceAddress - - -class Seller(object): - - """Implementation of the 'Seller' model. - - TODO: type model description here. - - Attributes: - name (str): TODO: type description here. - address (InvoiceAddress): TODO: type description here. - phone (str): TODO: type description here. - logo_url (str): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "name": 'name', - "address": 'address', - "phone": 'phone', - "logo_url": 'logo_url' - } - - _optionals = [ - 'name', - 'address', - 'phone', - 'logo_url', - ] - - _nullables = [ - 'logo_url', - ] - - def __init__(self, - name=APIHelper.SKIP, - address=APIHelper.SKIP, - phone=APIHelper.SKIP, - logo_url=APIHelper.SKIP, - additional_properties={}): - """Constructor for the Seller class""" - - # Initialize members of the class - if name is not APIHelper.SKIP: - self.name = name - if address is not APIHelper.SKIP: - self.address = address - if phone is not APIHelper.SKIP: - self.phone = phone - if logo_url is not APIHelper.SKIP: - self.logo_url = logo_url - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP - address = InvoiceAddress.from_dictionary(dictionary.get('address')) if 'address' in dictionary.keys() else APIHelper.SKIP - phone = dictionary.get("phone") if dictionary.get("phone") else APIHelper.SKIP - logo_url = dictionary.get("logo_url") if "logo_url" 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(name, - address, - phone, - logo_url, - dictionary) - - @classmethod - def validate(cls, dictionary): - """Validates dictionary against class required properties - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - boolean : if dictionary is valid contains required properties. - - """ - - if isinstance(dictionary, cls): - return True - - if not isinstance(dictionary, dict): - return False - - return True diff --git a/advancedbilling/models/shipping_address.py b/advancedbilling/models/shipping_address.py deleted file mode 100644 index c8544686..00000000 --- a/advancedbilling/models/shipping_address.py +++ /dev/null @@ -1,141 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -advanced_billing - -This file was automatically generated for Maxio by APIMATIC v3.0 ( - https://www.apimatic.io ). -""" -from advancedbilling.api_helper import APIHelper - - -class ShippingAddress(object): - - """Implementation of the 'ShippingAddress' model. - - TODO: type model description here. - - Attributes: - street (str): TODO: type description here. - line_2 (str): TODO: type description here. - city (str): TODO: type description here. - state (str): TODO: type description here. - zip (str): TODO: type description here. - country (str): TODO: type description here. - - """ - - # Create a mapping from Model property names to API property names - _names = { - "street": 'street', - "line_2": 'line2', - "city": 'city', - "state": 'state', - "zip": 'zip', - "country": 'country' - } - - _optionals = [ - 'street', - 'line_2', - 'city', - 'state', - 'zip', - 'country', - ] - - _nullables = [ - 'street', - 'line_2', - 'city', - 'state', - 'zip', - 'country', - ] - - def __init__(self, - street=APIHelper.SKIP, - line_2=APIHelper.SKIP, - city=APIHelper.SKIP, - state=APIHelper.SKIP, - zip=APIHelper.SKIP, - country=APIHelper.SKIP, - additional_properties={}): - """Constructor for the ShippingAddress class""" - - # Initialize members of the class - if street is not APIHelper.SKIP: - self.street = street - if line_2 is not APIHelper.SKIP: - self.line_2 = line_2 - if city is not APIHelper.SKIP: - self.city = city - if state is not APIHelper.SKIP: - self.state = state - if zip is not APIHelper.SKIP: - self.zip = zip - if country is not APIHelper.SKIP: - self.country = country - - # Add additional model properties to the instance - self.additional_properties = additional_properties - - @classmethod - def from_dictionary(cls, - dictionary): - """Creates an instance of this model from a dictionary - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - object: An instance of this structure class. - - """ - - if dictionary is None: - return None - - # Extract variables from the dictionary - street = dictionary.get("street") if "street" in dictionary.keys() else APIHelper.SKIP - line_2 = dictionary.get("line2") if "line2" in dictionary.keys() else APIHelper.SKIP - city = dictionary.get("city") if "city" in dictionary.keys() else APIHelper.SKIP - state = dictionary.get("state") if "state" in dictionary.keys() else APIHelper.SKIP - zip = dictionary.get("zip") if "zip" in dictionary.keys() else APIHelper.SKIP - country = dictionary.get("country") if "country" 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(street, - line_2, - city, - state, - zip, - country, - dictionary) - - @classmethod - def validate(cls, dictionary): - """Validates dictionary against class required properties - - Args: - dictionary (dictionary): A dictionary representation of the object - as obtained from the deserialization of the server's response. The - keys MUST match property names in the API description. - - Returns: - boolean : if dictionary is valid contains required properties. - - """ - - if isinstance(dictionary, cls): - return True - - if not isinstance(dictionary, dict): - return False - - return True diff --git a/advancedbilling/models/subscription.py b/advancedbilling/models/subscription.py index eb250104..6ef456d9 100644 --- a/advancedbilling/models/subscription.py +++ b/advancedbilling/models/subscription.py @@ -431,7 +431,7 @@ def __init__(self, delayed_cancel_at=APIHelper.SKIP, coupon_code=APIHelper.SKIP, snap_day=APIHelper.SKIP, - payment_collection_method='automatic', + payment_collection_method=APIHelper.SKIP, customer=APIHelper.SKIP, product=APIHelper.SKIP, credit_card=APIHelper.SKIP, @@ -522,7 +522,8 @@ def __init__(self, self.coupon_code = coupon_code if snap_day is not APIHelper.SKIP: self.snap_day = snap_day - self.payment_collection_method = payment_collection_method + if payment_collection_method is not APIHelper.SKIP: + self.payment_collection_method = payment_collection_method if customer is not APIHelper.SKIP: self.customer = customer if product is not APIHelper.SKIP: @@ -670,7 +671,7 @@ def from_dictionary(cls, delayed_cancel_at = APIHelper.SKIP coupon_code = dictionary.get("coupon_code") if "coupon_code" in dictionary.keys() else APIHelper.SKIP snap_day = dictionary.get("snap_day") if "snap_day" in dictionary.keys() else APIHelper.SKIP - payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else 'automatic' + payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else APIHelper.SKIP customer = Customer.from_dictionary(dictionary.get('customer')) if 'customer' in dictionary.keys() else APIHelper.SKIP product = Product.from_dictionary(dictionary.get('product')) if 'product' in dictionary.keys() else APIHelper.SKIP credit_card = CreditCardPaymentProfile.from_dictionary(dictionary.get('credit_card')) if 'credit_card' in dictionary.keys() else APIHelper.SKIP diff --git a/advancedbilling/models/subscription_custom_price.py b/advancedbilling/models/subscription_custom_price.py index 11808bc5..5478289f 100644 --- a/advancedbilling/models/subscription_custom_price.py +++ b/advancedbilling/models/subscription_custom_price.py @@ -182,11 +182,13 @@ def validate(cls, dictionary): if isinstance(dictionary, cls): return UnionTypeLookUp.get('SubscriptionCustomPricePriceInCents').validate(dictionary.price_in_cents).is_valid \ and UnionTypeLookUp.get('SubscriptionCustomPriceInterval').validate(dictionary.interval).is_valid \ - and APIHelper.is_valid_type(value=dictionary.interval_unit, type_callable=lambda value: IntervalUnit.validate(value)) + and APIHelper.is_valid_type(value=dictionary.interval_unit, + type_callable=lambda value: IntervalUnit.validate(value)) if not isinstance(dictionary, dict): return False return UnionTypeLookUp.get('SubscriptionCustomPricePriceInCents').validate(dictionary.get('price_in_cents')).is_valid \ and UnionTypeLookUp.get('SubscriptionCustomPriceInterval').validate(dictionary.get('interval')).is_valid \ - and APIHelper.is_valid_type(value=dictionary.get('interval_unit'), type_callable=lambda value: IntervalUnit.validate(value)) + and APIHelper.is_valid_type(value=dictionary.get('interval_unit'), + type_callable=lambda value: IntervalUnit.validate(value)) diff --git a/advancedbilling/models/subscription_group.py b/advancedbilling/models/subscription_group.py index 36e7c898..1b43f780 100644 --- a/advancedbilling/models/subscription_group.py +++ b/advancedbilling/models/subscription_group.py @@ -50,7 +50,7 @@ class SubscriptionGroup(object): def __init__(self, customer_id=APIHelper.SKIP, payment_profile=APIHelper.SKIP, - payment_collection_method='automatic', + payment_collection_method=APIHelper.SKIP, subscription_ids=APIHelper.SKIP, created_at=APIHelper.SKIP, additional_properties={}): @@ -61,7 +61,8 @@ def __init__(self, self.customer_id = customer_id if payment_profile is not APIHelper.SKIP: self.payment_profile = payment_profile - self.payment_collection_method = payment_collection_method + if payment_collection_method is not APIHelper.SKIP: + self.payment_collection_method = payment_collection_method if subscription_ids is not APIHelper.SKIP: self.subscription_ids = subscription_ids if created_at is not APIHelper.SKIP: @@ -91,7 +92,7 @@ def from_dictionary(cls, # Extract variables from the dictionary customer_id = dictionary.get("customer_id") if dictionary.get("customer_id") else APIHelper.SKIP payment_profile = SubscriptionGroupPaymentProfile.from_dictionary(dictionary.get('payment_profile')) if 'payment_profile' in dictionary.keys() else APIHelper.SKIP - payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else 'automatic' + payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else APIHelper.SKIP subscription_ids = dictionary.get("subscription_ids") if dictionary.get("subscription_ids") else APIHelper.SKIP created_at = APIHelper.RFC3339DateTime.from_value(dictionary.get("created_at")).datetime if dictionary.get("created_at") else APIHelper.SKIP # Clean out expected properties from dictionary diff --git a/advancedbilling/models/subscription_group_members_array_error.py b/advancedbilling/models/subscription_group_members_array_error.py index 2e1ad128..984048fc 100644 --- a/advancedbilling/models/subscription_group_members_array_error.py +++ b/advancedbilling/models/subscription_group_members_array_error.py @@ -79,9 +79,11 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.members, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.members, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('members'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('members'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/subscription_group_signup.py b/advancedbilling/models/subscription_group_signup.py index 6820464f..7e73bbe3 100644 --- a/advancedbilling/models/subscription_group_signup.py +++ b/advancedbilling/models/subscription_group_signup.py @@ -65,7 +65,7 @@ def __init__(self, payment_profile_id=APIHelper.SKIP, payer_id=APIHelper.SKIP, payer_reference=APIHelper.SKIP, - payment_collection_method='automatic', + payment_collection_method=APIHelper.SKIP, payer_attributes=APIHelper.SKIP, credit_card_attributes=APIHelper.SKIP, bank_account_attributes=APIHelper.SKIP, @@ -79,7 +79,8 @@ def __init__(self, self.payer_id = payer_id if payer_reference is not APIHelper.SKIP: self.payer_reference = payer_reference - self.payment_collection_method = payment_collection_method + if payment_collection_method is not APIHelper.SKIP: + self.payment_collection_method = payment_collection_method if payer_attributes is not APIHelper.SKIP: self.payer_attributes = payer_attributes if credit_card_attributes is not APIHelper.SKIP: @@ -116,7 +117,7 @@ def from_dictionary(cls, payment_profile_id = dictionary.get("payment_profile_id") if dictionary.get("payment_profile_id") else APIHelper.SKIP payer_id = dictionary.get("payer_id") if dictionary.get("payer_id") else APIHelper.SKIP payer_reference = dictionary.get("payer_reference") if dictionary.get("payer_reference") else APIHelper.SKIP - payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else 'automatic' + payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else APIHelper.SKIP payer_attributes = PayerAttributes.from_dictionary(dictionary.get('payer_attributes')) if 'payer_attributes' in dictionary.keys() else APIHelper.SKIP credit_card_attributes = SubscriptionGroupCreditCard.from_dictionary(dictionary.get('credit_card_attributes')) if 'credit_card_attributes' in dictionary.keys() else APIHelper.SKIP bank_account_attributes = SubscriptionGroupBankAccount.from_dictionary(dictionary.get('bank_account_attributes')) if 'bank_account_attributes' in dictionary.keys() else APIHelper.SKIP diff --git a/advancedbilling/models/subscription_group_signup_failure.py b/advancedbilling/models/subscription_group_signup_failure.py index b70a50ea..55917d91 100644 --- a/advancedbilling/models/subscription_group_signup_failure.py +++ b/advancedbilling/models/subscription_group_signup_failure.py @@ -91,11 +91,19 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.subscription_group, type_callable=lambda value: SubscriptionGroupSignupFailureData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.customer, type_callable=lambda value: isinstance(value, str), is_value_nullable=True) + return APIHelper.is_valid_type(value=dictionary.subscription_group, + type_callable=lambda value: SubscriptionGroupSignupFailureData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.customer, + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('subscription_group'), type_callable=lambda value: SubscriptionGroupSignupFailureData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('customer'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) + return APIHelper.is_valid_type(value=dictionary.get('subscription_group'), + type_callable=lambda value: SubscriptionGroupSignupFailureData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('customer'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) diff --git a/advancedbilling/models/subscription_group_signup_response.py b/advancedbilling/models/subscription_group_signup_response.py index 5aed4313..d0480e42 100644 --- a/advancedbilling/models/subscription_group_signup_response.py +++ b/advancedbilling/models/subscription_group_signup_response.py @@ -140,7 +140,7 @@ def __init__(self, state=APIHelper.SKIP, cancel_at_end_of_period=APIHelper.SKIP, subscriptions=APIHelper.SKIP, - payment_collection_method='automatic', + payment_collection_method=APIHelper.SKIP, additional_properties={}): """Constructor for the SubscriptionGroupSignupResponse class""" @@ -165,7 +165,8 @@ def __init__(self, self.cancel_at_end_of_period = cancel_at_end_of_period if subscriptions is not APIHelper.SKIP: self.subscriptions = subscriptions - self.payment_collection_method = payment_collection_method + if payment_collection_method is not APIHelper.SKIP: + self.payment_collection_method = payment_collection_method # Add additional model properties to the instance self.additional_properties = additional_properties @@ -203,7 +204,7 @@ def from_dictionary(cls, subscriptions = [SubscriptionGroupItem.from_dictionary(x) for x in dictionary.get('subscriptions')] else: subscriptions = APIHelper.SKIP - payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else 'automatic' + payment_collection_method = dictionary.get("payment_collection_method") if dictionary.get("payment_collection_method") else APIHelper.SKIP # Clean out expected properties from dictionary for key in cls._names.values(): if key in dictionary: diff --git a/advancedbilling/models/subscription_group_signup_success.py b/advancedbilling/models/subscription_group_signup_success.py index 15d15c88..6d2e3208 100644 --- a/advancedbilling/models/subscription_group_signup_success.py +++ b/advancedbilling/models/subscription_group_signup_success.py @@ -88,11 +88,19 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.subscription_group, type_callable=lambda value: SubscriptionGroupSignupSuccessData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.customer, type_callable=lambda value: Customer.validate(value)) + return APIHelper.is_valid_type(value=dictionary.subscription_group, + type_callable=lambda value: SubscriptionGroupSignupSuccessData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.customer, + type_callable=lambda value: Customer.validate(value), + is_model_dict=True) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('subscription_group'), type_callable=lambda value: SubscriptionGroupSignupSuccessData.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('customer'), type_callable=lambda value: Customer.validate(value)) + return APIHelper.is_valid_type(value=dictionary.get('subscription_group'), + type_callable=lambda value: SubscriptionGroupSignupSuccessData.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('customer'), + type_callable=lambda value: Customer.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/subscription_group_signup_success_data.py b/advancedbilling/models/subscription_group_signup_success_data.py index da1376a1..8616c873 100644 --- a/advancedbilling/models/subscription_group_signup_success_data.py +++ b/advancedbilling/models/subscription_group_signup_success_data.py @@ -127,25 +127,43 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.uid, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.scheme, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.customer_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.payment_profile_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.subscription_ids, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.primary_subscription_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.next_assessment_at, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ - and APIHelper.is_valid_type(value=dictionary.state, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.cancel_at_end_of_period, type_callable=lambda value: isinstance(value, bool)) + return APIHelper.is_valid_type(value=dictionary.uid, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.scheme, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.customer_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.payment_profile_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.subscription_ids, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.primary_subscription_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.next_assessment_at, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.state, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.cancel_at_end_of_period, + type_callable=lambda value: isinstance(value, bool)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('uid'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('scheme'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('customer_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('payment_profile_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('subscription_ids'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('primary_subscription_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('next_assessment_at'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('state'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('cancel_at_end_of_period'), type_callable=lambda value: isinstance(value, bool)) + return APIHelper.is_valid_type(value=dictionary.get('uid'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('scheme'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('customer_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('payment_profile_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('subscription_ids'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('primary_subscription_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('next_assessment_at'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('state'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('cancel_at_end_of_period'), + type_callable=lambda value: isinstance(value, bool)) diff --git a/advancedbilling/models/subscription_group_single_error.py b/advancedbilling/models/subscription_group_single_error.py index ff6f74c4..70711aa4 100644 --- a/advancedbilling/models/subscription_group_single_error.py +++ b/advancedbilling/models/subscription_group_single_error.py @@ -79,9 +79,11 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.subscription_group, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.subscription_group, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('subscription_group'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('subscription_group'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/subscription_product_change.py b/advancedbilling/models/subscription_product_change.py index d2b2b11a..0e8b0a87 100644 --- a/advancedbilling/models/subscription_product_change.py +++ b/advancedbilling/models/subscription_product_change.py @@ -85,11 +85,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.previous_product_id, type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.new_product_id, type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.previous_product_id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.new_product_id, + type_callable=lambda value: isinstance(value, int)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('previous_product_id'), type_callable=lambda value: isinstance(value, int)) \ - and APIHelper.is_valid_type(value=dictionary.get('new_product_id'), type_callable=lambda value: isinstance(value, int)) + return APIHelper.is_valid_type(value=dictionary.get('previous_product_id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('new_product_id'), + type_callable=lambda value: isinstance(value, int)) diff --git a/advancedbilling/models/subscription_state_change.py b/advancedbilling/models/subscription_state_change.py index 37a1f11d..1b1e94d1 100644 --- a/advancedbilling/models/subscription_state_change.py +++ b/advancedbilling/models/subscription_state_change.py @@ -85,11 +85,15 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.previous_subscription_state, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.new_subscription_state, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.previous_subscription_state, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.new_subscription_state, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('previous_subscription_state'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('new_subscription_state'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('previous_subscription_state'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('new_subscription_state'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/void_invoice_event.py b/advancedbilling/models/void_invoice_event.py new file mode 100644 index 00000000..d82c82bd --- /dev/null +++ b/advancedbilling/models/void_invoice_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType +from advancedbilling.models.void_invoice_event_data import VoidInvoiceEventData + + +class VoidInvoiceEvent(object): + + """Implementation of the 'Void Invoice Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (VoidInvoiceEventData): Example schema for an + `void_invoice` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='void_invoice', + event_data=None, + additional_properties={}): + """Constructor for the VoidInvoiceEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'void_invoice' + event_data = VoidInvoiceEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: VoidInvoiceEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: VoidInvoiceEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/void_invoice_event_data.py b/advancedbilling/models/void_invoice_event_data.py index aa59b88e..bef6bb54 100644 --- a/advancedbilling/models/void_invoice_event_data.py +++ b/advancedbilling/models/void_invoice_event_data.py @@ -119,19 +119,41 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.credit_note_attributes, type_callable=lambda value: CreditNote.validate(value), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.applied_amount, type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.transaction_time, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.is_advance_invoice, type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.reason, type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.credit_note_attributes, + type_callable=lambda value: CreditNote.validate(value), + is_value_nullable=True, + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.applied_amount, + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.transaction_time, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.is_advance_invoice, + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.reason, + type_callable=lambda value: isinstance(value, str)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('credit_note_attributes'), type_callable=lambda value: CreditNote.validate(value), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), type_callable=lambda value: isinstance(value, str), is_value_nullable=True) \ - and APIHelper.is_valid_type(value=dictionary.get('is_advance_invoice'), type_callable=lambda value: isinstance(value, bool)) \ - and APIHelper.is_valid_type(value=dictionary.get('reason'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('credit_note_attributes'), + type_callable=lambda value: CreditNote.validate(value), + is_value_nullable=True, + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), + type_callable=lambda value: isinstance(value, str), + is_value_nullable=True) \ + and APIHelper.is_valid_type(value=dictionary.get('is_advance_invoice'), + type_callable=lambda value: isinstance(value, bool)) \ + and APIHelper.is_valid_type(value=dictionary.get('reason'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/models/void_remainder_event.py b/advancedbilling/models/void_remainder_event.py new file mode 100644 index 00000000..865bfedb --- /dev/null +++ b/advancedbilling/models/void_remainder_event.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +advanced_billing + +This file was automatically generated for Maxio by APIMATIC v3.0 ( + https://www.apimatic.io ). +""" +from advancedbilling.api_helper import APIHelper +from advancedbilling.models.invoice import Invoice +from advancedbilling.models.invoice_event_type import InvoiceEventType +from advancedbilling.models.void_remainder_event_data import VoidRemainderEventData + + +class VoidRemainderEvent(object): + + """Implementation of the 'Void Remainder Event' model. + + TODO: type model description here. + + Attributes: + id (long|int): TODO: type description here. + timestamp (datetime): TODO: type description here. + invoice (Invoice): TODO: type description here. + event_type (InvoiceEventType): TODO: type description here. + event_data (VoidRemainderEventData): Example schema for an + `void_remainder` event + + """ + + # Create a mapping from Model property names to API property names + _names = { + "id": 'id', + "timestamp": 'timestamp', + "invoice": 'invoice', + "event_type": 'event_type', + "event_data": 'event_data' + } + + def __init__(self, + id=None, + timestamp=None, + invoice=None, + event_type='void_remainder', + event_data=None, + additional_properties={}): + """Constructor for the VoidRemainderEvent class""" + + # Initialize members of the class + self.id = id + self.timestamp = APIHelper.apply_datetime_converter(timestamp, APIHelper.RFC3339DateTime) if timestamp else None + self.invoice = invoice + self.event_type = event_type + self.event_data = event_data + + # Add additional model properties to the instance + self.additional_properties = additional_properties + + @classmethod + def from_dictionary(cls, + dictionary): + """Creates an instance of this model from a dictionary + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + object: An instance of this structure class. + + """ + + if dictionary is None: + return None + + # Extract variables from the dictionary + id = dictionary.get("id") if dictionary.get("id") else None + timestamp = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestamp")).datetime if dictionary.get("timestamp") else None + invoice = Invoice.from_dictionary(dictionary.get('invoice')) if dictionary.get('invoice') else None + event_type = dictionary.get("event_type") if dictionary.get("event_type") else 'void_remainder' + event_data = VoidRemainderEventData.from_dictionary(dictionary.get('event_data')) if dictionary.get('event_data') else None + # 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(id, + timestamp, + invoice, + event_type, + event_data, + dictionary) + + @classmethod + def validate(cls, dictionary): + """Validates dictionary against class required properties + + Args: + dictionary (dictionary): A dictionary representation of the object + as obtained from the deserialization of the server's response. The + keys MUST match property names in the API description. + + Returns: + boolean : if dictionary is valid contains required properties. + + """ + + if isinstance(dictionary, cls): + return APIHelper.is_valid_type(value=dictionary.id, + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.timestamp, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) \ + and APIHelper.is_valid_type(value=dictionary.invoice, + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.event_type, + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.event_data, + type_callable=lambda value: VoidRemainderEventData.validate(value), + is_model_dict=True) + + if not isinstance(dictionary, dict): + return False + + return APIHelper.is_valid_type(value=dictionary.get('id'), + type_callable=lambda value: isinstance(value, int)) \ + and APIHelper.is_valid_type(value=dictionary.get('timestamp'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('invoice'), + type_callable=lambda value: Invoice.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('event_type'), + type_callable=lambda value: InvoiceEventType.validate(value)) \ + and APIHelper.is_valid_type(value=dictionary.get('event_data'), + type_callable=lambda value: VoidRemainderEventData.validate(value), + is_model_dict=True) diff --git a/advancedbilling/models/void_remainder_event_data.py b/advancedbilling/models/void_remainder_event_data.py index 2fba2def..a25a6b45 100644 --- a/advancedbilling/models/void_remainder_event_data.py +++ b/advancedbilling/models/void_remainder_event_data.py @@ -99,15 +99,25 @@ def validate(cls, dictionary): """ if isinstance(dictionary, cls): - return APIHelper.is_valid_type(value=dictionary.credit_note_attributes, type_callable=lambda value: CreditNote.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.memo, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.applied_amount, type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.transaction_time, type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) + return APIHelper.is_valid_type(value=dictionary.credit_note_attributes, + type_callable=lambda value: CreditNote.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.memo, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.applied_amount, + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.transaction_time, + type_callable=lambda value: isinstance(value, APIHelper.RFC3339DateTime)) if not isinstance(dictionary, dict): return False - return APIHelper.is_valid_type(value=dictionary.get('credit_note_attributes'), type_callable=lambda value: CreditNote.validate(value)) \ - and APIHelper.is_valid_type(value=dictionary.get('memo'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), type_callable=lambda value: isinstance(value, str)) \ - and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), type_callable=lambda value: isinstance(value, str)) + return APIHelper.is_valid_type(value=dictionary.get('credit_note_attributes'), + type_callable=lambda value: CreditNote.validate(value), + is_model_dict=True) \ + and APIHelper.is_valid_type(value=dictionary.get('memo'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('applied_amount'), + type_callable=lambda value: isinstance(value, str)) \ + and APIHelper.is_valid_type(value=dictionary.get('transaction_time'), + type_callable=lambda value: isinstance(value, str)) diff --git a/advancedbilling/utilities/union_type_lookup.py b/advancedbilling/utilities/union_type_lookup.py index 5b89ac24..367b20b0 100644 --- a/advancedbilling/utilities/union_type_lookup.py +++ b/advancedbilling/utilities/union_type_lookup.py @@ -7,31 +7,31 @@ https://www.apimatic.io ). """ -from advancedbilling.models.apply_credit_note_event_data import ApplyCreditNoteEventData -from advancedbilling.models.apply_debit_note_event_data import ApplyDebitNoteEventData -from advancedbilling.models.apply_payment_event_data import ApplyPaymentEventData +from advancedbilling.models.apply_credit_note_event import ApplyCreditNoteEvent +from advancedbilling.models.apply_debit_note_event import ApplyDebitNoteEvent +from advancedbilling.models.apply_payment_event import ApplyPaymentEvent +from advancedbilling.models.backport_invoice_event import BackportInvoiceEvent from advancedbilling.models.bank_account_payment_profile import BankAccountPaymentProfile -from advancedbilling.models.change_chargeback_status_event_data import ChangeChargebackStatusEventData -from advancedbilling.models.change_invoice_collection_method_event_data import ChangeInvoiceCollectionMethodEventData -from advancedbilling.models.change_invoice_status_event_data import ChangeInvoiceStatusEventData +from advancedbilling.models.change_chargeback_status_event import ChangeChargebackStatusEvent +from advancedbilling.models.change_invoice_collection_method_event import ChangeInvoiceCollectionMethodEvent +from advancedbilling.models.change_invoice_status_event import ChangeInvoiceStatusEvent from advancedbilling.models.component_allocation_change import ComponentAllocationChange from advancedbilling.models.create_component_price_point import CreateComponentPricePoint +from advancedbilling.models.create_credit_note_event import CreateCreditNoteEvent +from advancedbilling.models.create_debit_note_event import CreateDebitNoteEvent from advancedbilling.models.create_metafield import CreateMetafield from advancedbilling.models.create_or_update_flat_amount_coupon import CreateOrUpdateFlatAmountCoupon from advancedbilling.models.create_or_update_percentage_coupon import CreateOrUpdatePercentageCoupon from advancedbilling.models.create_prepaid_usage_component_price_point import CreatePrepaidUsageComponentPricePoint from advancedbilling.models.credit_account_balance_changed import CreditAccountBalanceChanged from advancedbilling.models.credit_card_payment_profile import CreditCardPaymentProfile -from advancedbilling.models.credit_note import CreditNote from advancedbilling.models.custom_field_value_change import CustomFieldValueChange from advancedbilling.models.customer_error import CustomerError -from advancedbilling.models.debit_note import DebitNote from advancedbilling.models.dunning_step_reached import DunningStepReached -from advancedbilling.models.failed_payment_event_data import FailedPaymentEventData +from advancedbilling.models.failed_payment_event import FailedPaymentEvent from advancedbilling.models.group_settings import GroupSettings -from advancedbilling.models.invoice import Invoice from advancedbilling.models.invoice_issued import InvoiceIssued -from advancedbilling.models.issue_invoice_event_data import IssueInvoiceEventData +from advancedbilling.models.issue_invoice_event import IssueInvoiceEvent from advancedbilling.models.item_price_point_changed import ItemPricePointChanged from advancedbilling.models.metered_usage import MeteredUsage from advancedbilling.models.payment_collection_method_changed import PaymentCollectionMethodChanged @@ -48,9 +48,9 @@ from advancedbilling.models.proforma_invoice_issued import ProformaInvoiceIssued from advancedbilling.models.refund_consolidated_invoice import RefundConsolidatedInvoice from advancedbilling.models.refund_invoice import RefundInvoice -from advancedbilling.models.refund_invoice_event_data import RefundInvoiceEventData +from advancedbilling.models.refund_invoice_event import RefundInvoiceEvent from advancedbilling.models.refund_success import RefundSuccess -from advancedbilling.models.remove_payment_event_data import RemovePaymentEventData +from advancedbilling.models.remove_payment_event import RemovePaymentEvent from advancedbilling.models.resume_options import ResumeOptions from advancedbilling.models.snap_day import SnapDay from advancedbilling.models.subscription_group_members_array_error import SubscriptionGroupMembersArrayError @@ -60,8 +60,8 @@ from advancedbilling.models.subscription_product_change import SubscriptionProductChange from advancedbilling.models.subscription_state_change import SubscriptionStateChange from advancedbilling.models.update_metafield import UpdateMetafield -from advancedbilling.models.void_invoice_event_data import VoidInvoiceEventData -from advancedbilling.models.void_remainder_event_data import VoidRemainderEventData +from advancedbilling.models.void_invoice_event import VoidInvoiceEvent +from advancedbilling.models.void_remainder_event import VoidRemainderEvent from apimatic_core.types.union_types.any_of import AnyOf from apimatic_core.types.union_types.leaf_type import LeafType from apimatic_core.types.union_types.one_of import OneOf @@ -136,6 +136,89 @@ class UnionTypeLookUp: LeafType(str) ] ), + 'Invoice-Event': AnyOf( + [ + LeafType(ApplyCreditNoteEvent, + Context.create( + discriminator_value='apply_credit_note', + discriminator='event_type' + )), + LeafType(ApplyDebitNoteEvent, + Context.create( + discriminator_value='apply_debit_note', + discriminator='event_type' + )), + LeafType(ApplyPaymentEvent, + Context.create( + discriminator_value='apply_payment', + discriminator='event_type' + )), + LeafType(BackportInvoiceEvent, + Context.create( + discriminator_value='backport_invoice', + discriminator='event_type' + )), + LeafType(ChangeChargebackStatusEvent, + Context.create( + discriminator_value='change_chargeback_status', + discriminator='event_type' + )), + LeafType(ChangeInvoiceCollectionMethodEvent, + Context.create( + discriminator_value='change_invoice_collection_method', + discriminator='event_type' + )), + LeafType(ChangeInvoiceStatusEvent, + Context.create( + discriminator_value='change_invoice_status', + discriminator='event_type' + )), + LeafType(CreateCreditNoteEvent, + Context.create( + discriminator_value='create_credit_note', + discriminator='event_type' + )), + LeafType(CreateDebitNoteEvent, + Context.create( + discriminator_value='create_debit_note', + discriminator='event_type' + )), + LeafType(FailedPaymentEvent, + Context.create( + discriminator_value='failed_payment', + discriminator='event_type' + )), + LeafType(IssueInvoiceEvent, + Context.create( + discriminator_value='issue_invoice', + discriminator='event_type' + )), + LeafType(RefundInvoiceEvent, + Context.create( + discriminator_value='refund_invoice', + discriminator='event_type' + )), + LeafType(RemovePaymentEvent, + Context.create( + discriminator_value='remove_payment', + discriminator='event_type' + )), + LeafType(VoidInvoiceEvent, + Context.create( + discriminator_value='void_invoice', + discriminator='event_type' + )), + LeafType(VoidRemainderEvent, + Context.create( + discriminator_value='void_remainder', + discriminator='event_type' + )) + ], + Context.create( + is_array=True, + is_optional=True + ) + ), 'AddSubscriptionToAGroupGroup': OneOf( [ LeafType(GroupSettings), @@ -539,40 +622,6 @@ class UnionTypeLookUp: is_nullable=True ) ), - 'InvoiceEventEventData': AnyOf( - [ - LeafType(ApplyCreditNoteEventData), - LeafType(ApplyDebitNoteEventData), - LeafType(ApplyPaymentEventData), - LeafType(ChangeInvoiceCollectionMethodEventData), - LeafType(IssueInvoiceEventData), - LeafType(RefundInvoiceEventData), - LeafType(RemovePaymentEventData), - LeafType(VoidInvoiceEventData), - LeafType(VoidRemainderEventData), - LeafType(Invoice), - LeafType(ChangeInvoiceStatusEventData), - LeafType(FailedPaymentEventData), - LeafType(DebitNote), - LeafType(CreditNote), - LeafType(ChangeChargebackStatusEventData) - ], - Context.create( - is_optional=True - ) - ), - 'InvoiceEventDataPaymentMethod': AnyOf( - [ - LeafType(PaymentMethodApplePay), - LeafType(PaymentMethodBankAccount), - LeafType(PaymentMethodCreditCard), - LeafType(PaymentMethodExternal), - LeafType(PaymentMethodPaypal) - ], - Context.create( - is_optional=True - ) - ), 'IssueServiceCreditAmount': OneOf( [ LeafType(float), @@ -683,18 +732,6 @@ class UnionTypeLookUp: is_optional=True ) ), - 'RefundSegmentUids': OneOf( - [ - LeafType(str, - Context.create( - is_array=True - )), - LeafType(str) - ], - Context.create( - is_optional=True - ) - ), 'RefundConsolidatedInvoiceSegmentUids': OneOf( [ LeafType(str, diff --git a/doc/client.md b/doc/client.md index 9c77b3ef..5d558d77 100644 --- a/doc/client.md +++ b/doc/client.md @@ -25,7 +25,9 @@ client = AdvancedBillingClient( basic_auth_credentials=BasicAuthCredentials( username='BasicAuthUserName', password='BasicAuthPassword' - ) + ), + subdomain='subdomain', + domain='chargify.com' ) ``` diff --git a/doc/models/apply-credit-note-event.md b/doc/models/apply-credit-note-event.md new file mode 100644 index 00000000..9650dc02 --- /dev/null +++ b/doc/models/apply-credit-note-event.md @@ -0,0 +1,62 @@ + +# Apply Credit Note Event + +## Structure + +`ApplyCreditNoteEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'apply_credit_note'` | +| `event_data` | [`ApplyCreditNoteEventData`](../../doc/models/apply-credit-note-event-data.md) | Required | Example schema for an `apply_credit_note` event | + +## Example (as JSON) + +```json +{ + "id": 214, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "apply_credit_note", + "event_data": { + "uid": "uid6", + "credit_note_number": "credit_note_number0", + "credit_note_uid": "credit_note_uid0", + "original_amount": "original_amount0", + "applied_amount": "applied_amount2", + "transaction_time": "2016-03-13T12:52:32.123Z", + "memo": "memo0", + "role": "role0", + "consolidated_invoice": false, + "applied_credit_notes": [ + { + "uid": "uid4", + "number": "number8" + }, + { + "uid": "uid4", + "number": "number8" + }, + { + "uid": "uid4", + "number": "number8" + } + ] + } +} +``` + diff --git a/doc/models/apply-debit-note-event.md b/doc/models/apply-debit-note-event.md new file mode 100644 index 00000000..b199abff --- /dev/null +++ b/doc/models/apply-debit-note-event.md @@ -0,0 +1,45 @@ + +# Apply Debit Note Event + +## Structure + +`ApplyDebitNoteEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'apply_debit_note'` | +| `event_data` | [`ApplyDebitNoteEventData`](../../doc/models/apply-debit-note-event-data.md) | Required | Example schema for an `apply_debit_note` event | + +## Example (as JSON) + +```json +{ + "id": 164, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "apply_debit_note", + "event_data": { + "debit_note_number": "debit_note_number6", + "debit_note_uid": "debit_note_uid2", + "original_amount": "original_amount0", + "applied_amount": "applied_amount2", + "memo": "memo0", + "transaction_time": "2016-03-13T12:52:32.123Z" + } +} +``` + diff --git a/doc/models/apply-payment-event.md b/doc/models/apply-payment-event.md new file mode 100644 index 00000000..67194778 --- /dev/null +++ b/doc/models/apply-payment-event.md @@ -0,0 +1,52 @@ + +# Apply Payment Event + +## Structure + +`ApplyPaymentEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'apply_payment'` | +| `event_data` | [`ApplyPaymentEventData`](../../doc/models/apply-payment-event-data.md) | Required | Example schema for an `apply_payment` event | + +## Example (as JSON) + +```json +{ + "id": 234, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "apply_payment", + "event_data": { + "consolidation_level": "child", + "memo": "memo0", + "original_amount": "original_amount0", + "applied_amount": "applied_amount2", + "transaction_time": "2016-03-13T12:52:32.123Z", + "payment_method": { + "type": "apple_pay" + }, + "transaction_id": 78, + "parent_invoice_number": 36, + "remaining_prepayment_amount": "remaining_prepayment_amount6", + "prepayment": false, + "external": false + } +} +``` + diff --git a/doc/models/backport-invoice-event.md b/doc/models/backport-invoice-event.md new file mode 100644 index 00000000..03dfdd97 --- /dev/null +++ b/doc/models/backport-invoice-event.md @@ -0,0 +1,47 @@ + +# Backport Invoice Event + +## Structure + +`BackportInvoiceEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'backport_invoice'` | +| `event_data` | [`Invoice`](../../doc/models/invoice.md) | Required | Example schema for an `backport_invoice` event | + +## Example (as JSON) + +```json +{ + "id": 78, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "backport_invoice", + "event_data": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 206, + "uid": "uid6", + "site_id": 132, + "customer_id": 244, + "subscription_id": 60 + } +} +``` + diff --git a/doc/models/billing-address.md b/doc/models/billing-address.md deleted file mode 100644 index 8d36be70..00000000 --- a/doc/models/billing-address.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Billing Address - -## Structure - -`BillingAddress` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `street` | `str` | Optional | - | -| `line_2` | `str` | Optional | - | -| `city` | `str` | Optional | - | -| `state` | `str` | Optional | - | -| `zip` | `str` | Optional | - | -| `country` | `str` | Optional | - | - -## Example (as JSON) - -```json -{ - "street": "street6", - "line2": "line20", - "city": "city6", - "state": "state2", - "zip": "zip0" -} -``` - diff --git a/doc/models/change-chargeback-status-event.md b/doc/models/change-chargeback-status-event.md new file mode 100644 index 00000000..2827593c --- /dev/null +++ b/doc/models/change-chargeback-status-event.md @@ -0,0 +1,40 @@ + +# Change Chargeback Status Event + +## Structure + +`ChangeChargebackStatusEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'change_chargeback_status'` | +| `event_data` | [`ChangeChargebackStatusEventData`](../../doc/models/change-chargeback-status-event-data.md) | Required | Example schema for an `change_chargeback_status` event | + +## Example (as JSON) + +```json +{ + "id": 214, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "change_chargeback_status", + "event_data": { + "chargeback_status": "won" + } +} +``` + diff --git a/doc/models/change-invoice-collection-method-event.md b/doc/models/change-invoice-collection-method-event.md new file mode 100644 index 00000000..f9604e69 --- /dev/null +++ b/doc/models/change-invoice-collection-method-event.md @@ -0,0 +1,41 @@ + +# Change Invoice Collection Method Event + +## Structure + +`ChangeInvoiceCollectionMethodEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'change_invoice_collection_method'` | +| `event_data` | [`ChangeInvoiceCollectionMethodEventData`](../../doc/models/change-invoice-collection-method-event-data.md) | Required | Example schema for an `change_invoice_collection_method` event | + +## Example (as JSON) + +```json +{ + "id": 246, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "change_invoice_collection_method", + "event_data": { + "from_collection_method": "from_collection_method4", + "to_collection_method": "to_collection_method8" + } +} +``` + diff --git a/doc/models/change-invoice-status-event.md b/doc/models/change-invoice-status-event.md new file mode 100644 index 00000000..8f121fa6 --- /dev/null +++ b/doc/models/change-invoice-status-event.md @@ -0,0 +1,44 @@ + +# Change Invoice Status Event + +## Structure + +`ChangeInvoiceStatusEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'change_invoice_status'` | +| `event_data` | [`ChangeInvoiceStatusEventData`](../../doc/models/change-invoice-status-event-data.md) | Required | Example schema for an `change_invoice_status` event | + +## Example (as JSON) + +```json +{ + "id": 92, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "change_invoice_status", + "event_data": { + "gateway_trans_id": "gateway_trans_id2", + "amount": "amount8", + "from_status": "paid", + "to_status": "paid", + "consolidation_level": "child" + } +} +``` + diff --git a/doc/models/containers/invoice-event-data-payment-method.md b/doc/models/containers/invoice-event-data-payment-method.md deleted file mode 100644 index de216b97..00000000 --- a/doc/models/containers/invoice-event-data-payment-method.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Invoice Event Data Payment Method - -## Data Type - -`PaymentMethodApplePay | PaymentMethodBankAccount | PaymentMethodCreditCard | PaymentMethodExternal | PaymentMethodPaypal` - -## Cases - -| Type | -| --- | -| [`PaymentMethodApplePay`](../../../doc/models/payment-method-apple-pay.md) | -| [`PaymentMethodBankAccount`](../../../doc/models/payment-method-bank-account.md) | -| [`PaymentMethodCreditCard`](../../../doc/models/payment-method-credit-card.md) | -| [`PaymentMethodExternal`](../../../doc/models/payment-method-external.md) | -| [`PaymentMethodPaypal`](../../../doc/models/payment-method-paypal.md) | - diff --git a/doc/models/containers/invoice-event-event-data.md b/doc/models/containers/invoice-event-event-data.md deleted file mode 100644 index f10fde78..00000000 --- a/doc/models/containers/invoice-event-event-data.md +++ /dev/null @@ -1,27 +0,0 @@ - -# Invoice Event Event Data - -## Data Type - -`ApplyCreditNoteEventData | ApplyDebitNoteEventData | ApplyPaymentEventData | ChangeInvoiceCollectionMethodEventData | IssueInvoiceEventData | RefundInvoiceEventData | RemovePaymentEventData | VoidInvoiceEventData | VoidRemainderEventData | Invoice | ChangeInvoiceStatusEventData | FailedPaymentEventData | DebitNote | CreditNote | ChangeChargebackStatusEventData` - -## Cases - -| Type | -| --- | -| [`ApplyCreditNoteEventData`](../../../doc/models/apply-credit-note-event-data.md) | -| [`ApplyDebitNoteEventData`](../../../doc/models/apply-debit-note-event-data.md) | -| [`ApplyPaymentEventData`](../../../doc/models/apply-payment-event-data.md) | -| [`ChangeInvoiceCollectionMethodEventData`](../../../doc/models/change-invoice-collection-method-event-data.md) | -| [`IssueInvoiceEventData`](../../../doc/models/issue-invoice-event-data.md) | -| [`RefundInvoiceEventData`](../../../doc/models/refund-invoice-event-data.md) | -| [`RemovePaymentEventData`](../../../doc/models/remove-payment-event-data.md) | -| [`VoidInvoiceEventData`](../../../doc/models/void-invoice-event-data.md) | -| [`VoidRemainderEventData`](../../../doc/models/void-remainder-event-data.md) | -| [`Invoice`](../../../doc/models/invoice.md) | -| [`ChangeInvoiceStatusEventData`](../../../doc/models/change-invoice-status-event-data.md) | -| [`FailedPaymentEventData`](../../../doc/models/failed-payment-event-data.md) | -| [`DebitNote`](../../../doc/models/debit-note.md) | -| [`CreditNote`](../../../doc/models/credit-note.md) | -| [`ChangeChargebackStatusEventData`](../../../doc/models/change-chargeback-status-event-data.md) | - diff --git a/doc/models/containers/invoice-event.md b/doc/models/containers/invoice-event.md new file mode 100644 index 00000000..94c8fa49 --- /dev/null +++ b/doc/models/containers/invoice-event.md @@ -0,0 +1,27 @@ + +# Invoice-Event + +## Data Type + +`ApplyCreditNoteEvent | ApplyDebitNoteEvent | ApplyPaymentEvent | BackportInvoiceEvent | ChangeChargebackStatusEvent | ChangeInvoiceCollectionMethodEvent | ChangeInvoiceStatusEvent | CreateCreditNoteEvent | CreateDebitNoteEvent | FailedPaymentEvent | IssueInvoiceEvent | RefundInvoiceEvent | RemovePaymentEvent | VoidInvoiceEvent | VoidRemainderEvent` + +## Cases + +| Type | +| --- | +| [`ApplyCreditNoteEvent`](../../../doc/models/apply-credit-note-event.md) | +| [`ApplyDebitNoteEvent`](../../../doc/models/apply-debit-note-event.md) | +| [`ApplyPaymentEvent`](../../../doc/models/apply-payment-event.md) | +| [`BackportInvoiceEvent`](../../../doc/models/backport-invoice-event.md) | +| [`ChangeChargebackStatusEvent`](../../../doc/models/change-chargeback-status-event.md) | +| [`ChangeInvoiceCollectionMethodEvent`](../../../doc/models/change-invoice-collection-method-event.md) | +| [`ChangeInvoiceStatusEvent`](../../../doc/models/change-invoice-status-event.md) | +| [`CreateCreditNoteEvent`](../../../doc/models/create-credit-note-event.md) | +| [`CreateDebitNoteEvent`](../../../doc/models/create-debit-note-event.md) | +| [`FailedPaymentEvent`](../../../doc/models/failed-payment-event.md) | +| [`IssueInvoiceEvent`](../../../doc/models/issue-invoice-event.md) | +| [`RefundInvoiceEvent`](../../../doc/models/refund-invoice-event.md) | +| [`RemovePaymentEvent`](../../../doc/models/remove-payment-event.md) | +| [`VoidInvoiceEvent`](../../../doc/models/void-invoice-event.md) | +| [`VoidRemainderEvent`](../../../doc/models/void-remainder-event.md) | + diff --git a/doc/models/containers/refund-segment-uids.md b/doc/models/containers/refund-segment-uids.md deleted file mode 100644 index 92d3cf70..00000000 --- a/doc/models/containers/refund-segment-uids.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Refund Segment Uids - -## Data Type - -`List[str] | str` - -## Cases - -| Type | -| --- | -| `List[str]` | -| `str` | - diff --git a/doc/models/create-credit-note-event.md b/doc/models/create-credit-note-event.md new file mode 100644 index 00000000..ce9308d1 --- /dev/null +++ b/doc/models/create-credit-note-event.md @@ -0,0 +1,44 @@ + +# Create Credit Note Event + +## Structure + +`CreateCreditNoteEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'create_credit_note'` | +| `event_data` | [`CreditNote`](../../doc/models/credit-note.md) | Required | Example schema for an `create_credit_note` event | + +## Example (as JSON) + +```json +{ + "id": 28, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "create_credit_note", + "event_data": { + "uid": "uid6", + "site_id": 132, + "customer_id": 244, + "subscription_id": 60, + "number": "number6" + } +} +``` + diff --git a/doc/models/create-debit-note-event.md b/doc/models/create-debit-note-event.md new file mode 100644 index 00000000..31c3364b --- /dev/null +++ b/doc/models/create-debit-note-event.md @@ -0,0 +1,44 @@ + +# Create Debit Note Event + +## Structure + +`CreateDebitNoteEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'create_debit_note'` | +| `event_data` | [`DebitNote`](../../doc/models/debit-note.md) | Required | Example schema for an `create_debit_note` event | + +## Example (as JSON) + +```json +{ + "id": 98, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "create_debit_note", + "event_data": { + "uid": "uid6", + "site_id": 132, + "customer_id": 244, + "subscription_id": 60, + "number": 64 + } +} +``` + diff --git a/doc/models/create-subscription-request.md b/doc/models/create-subscription-request.md index e4910d02..32da40e5 100644 --- a/doc/models/create-subscription-request.md +++ b/doc/models/create-subscription-request.md @@ -16,7 +16,6 @@ ```json { "subscription": { - "payment_collection_method": "automatic", "metafields": { "custom_field_name_1": "custom_field_value_1", "custom_field_name_2": "custom_field_value_2" diff --git a/doc/models/create-subscription.md b/doc/models/create-subscription.md index 0c9a0737..9d966dd9 100644 --- a/doc/models/create-subscription.md +++ b/doc/models/create-subscription.md @@ -16,7 +16,7 @@ | `custom_price` | [`SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription | | `coupon_code` | `str` | Optional | (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. | | `coupon_codes` | `List[str]` | Optional | An array for all the coupons attached to the subscription. | -| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | +| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `receives_invoice_emails` | `str` | Optional | (Optional) Default: True - Whether or not this subscription is set to receive emails related to this subscription. | | `net_terms` | `str` | Optional | (Optional) Default: null The number of days after renewal (on invoice billing) that a subscription is due. A value between 0 (due immediately) and 180. | | `customer_id` | `int` | Optional | The ID of an existing customer within Chargify. Required, unless a `customer_reference` or a set of `customer_attributes` is given. | @@ -63,7 +63,6 @@ ```json { - "payment_collection_method": "automatic", "metafields": { "custom_field_name_1": "custom_field_value_1", "custom_field_name_2": "custom_field_value_2" diff --git a/doc/models/credit-note-1.md b/doc/models/credit-note-1.md deleted file mode 100644 index f0adc8a5..00000000 --- a/doc/models/credit-note-1.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Credit Note 1 - -## Structure - -`CreditNote1` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `str` | Optional | Unique identifier for the credit note. It is generated automatically by Chargify and has the prefix "cn_" followed by alphanumeric characters. | -| `site_id` | `int` | Optional | ID of the site to which the credit note belongs. | -| `customer_id` | `int` | Optional | ID of the customer to which the credit note belongs. | -| `subscription_id` | `int` | Optional | ID of the subscription that generated the credit note. | -| `number` | `str` | Optional | A unique, identifying string that appears on the credit note and in places it is referenced.

While the UID is long and not appropriate to show to customers, the number is usually shorter and consumable by the customer and the merchant alike. | -| `sequence_number` | `int` | Optional | A monotonically increasing number assigned to credit notes as they are created. This number is unique within a site and can be used to sort and order credit notes. | -| `issue_date` | `date` | Optional | Date the credit note was issued to the customer. This is the date that the credit was made available for application, and may come before it is fully applied.

The format is `"YYYY-MM-DD"`. | -| `applied_date` | `date` | Optional | Credit notes are applied to invoices to offset invoiced amounts - they reduce the amount due. This field is the date the credit note became fully applied to invoices.

If the credit note has been partially applied, this field will not have a value until it has been fully applied.

The format is `"YYYY-MM-DD"`. | -| `status` | [`CreditNoteStatus`](../../doc/models/credit-note-status.md) | Optional | Current status of the credit note. | -| `currency` | `str` | Optional | The ISO 4217 currency code (3 character string) representing the currency of the credit note amount fields. | -| `memo` | `str` | Optional | The memo printed on credit note, which is a description of the reason for the credit. | -| `seller` | [`Seller`](../../doc/models/seller.md) | Optional | - | -| `customer` | [`Customer1`](../../doc/models/customer-1.md) | Optional | - | -| `billing_address` | [`BillingAddress`](../../doc/models/billing-address.md) | Optional | - | -| `shipping_address` | [`ShippingAddress`](../../doc/models/shipping-address.md) | Optional | - | -| `subtotal_amount` | `str` | Optional | Subtotal of the credit note, which is the sum of all line items before discounts or taxes. Note that this is a positive amount representing the credit back to the customer. | -| `discount_amount` | `str` | Optional | Total discount applied to the credit note. Note that this is a positive amount representing the discount amount being credited back to the customer (i.e. a credit on an earlier discount). For example, if the original purchase was $1.00 and the original discount was $0.10, a credit of $0.50 of the original purchase (half) would have a discount credit of $0.05 (also half). | -| `tax_amount` | `str` | Optional | Total tax of the credit note. Note that this is a positive amount representing a previously taxex amount being credited back to the customer (i.e. a credit of an earlier tax). For example, if the original purchase was $1.00 and the original tax was $0.10, a credit of $0.50 of the original purchase (half) would also have a tax credit of $0.05 (also half). | -| `total_amount` | `str` | Optional | The credit note total, which is `subtotal_amount - discount_amount + tax_amount`.' | -| `applied_amount` | `str` | Optional | The amount of the credit note that has already been applied to invoices. | -| `remaining_amount` | `str` | Optional | The amount of the credit note remaining to be applied to invoices, which is `total_amount - applied_amount`. | -| `line_items` | [`List[CreditNoteLineItem]`](../../doc/models/credit-note-line-item.md) | Optional | Line items on the credit note. | -| `discounts` | [`List[InvoiceDiscount]`](../../doc/models/invoice-discount.md) | Optional | - | -| `taxes` | [`List[InvoiceTax]`](../../doc/models/invoice-tax.md) | Optional | - | -| `applications` | [`List[CreditNoteApplication]`](../../doc/models/credit-note-application.md) | Optional | - | -| `refunds` | [`List[InvoiceRefund]`](../../doc/models/invoice-refund.md) | Optional | - | -| `origin_invoices` | [`List[OriginInvoice]`](../../doc/models/origin-invoice.md) | Optional | An array of origin invoices for the credit note. Learn more about [Origin Invoice from our docs](https://chargify.zendesk.com/hc/en-us/articles/4407753036699#origin-invoices) | - -## Example (as JSON) - -```json -{ - "uid": "uid8", - "site_id": 120, - "customer_id": 232, - "subscription_id": 48, - "number": "number6" -} -``` - diff --git a/doc/models/customer-1.md b/doc/models/customer-1.md deleted file mode 100644 index 57654d67..00000000 --- a/doc/models/customer-1.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Customer 1 - -## Structure - -`Customer1` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `chargify_id` | `int` | Optional | - | -| `first_name` | `str` | Optional | - | -| `last_name` | `str` | Optional | - | -| `organization` | `str` | Optional | - | -| `email` | `str` | Optional | - | -| `vat_number` | `str` | Optional | - | -| `reference` | `str` | Optional | - | - -## Example (as JSON) - -```json -{ - "chargify_id": 126, - "first_name": "first_name8", - "last_name": "last_name6", - "organization": "organization8", - "email": "email8" -} -``` - diff --git a/doc/models/failed-payment-event.md b/doc/models/failed-payment-event.md new file mode 100644 index 00000000..e6791297 --- /dev/null +++ b/doc/models/failed-payment-event.md @@ -0,0 +1,44 @@ + +# Failed Payment Event + +## Structure + +`FailedPaymentEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'failed_payment'` | +| `event_data` | [`FailedPaymentEventData`](../../doc/models/failed-payment-event-data.md) | Required | Example schema for an `failed_payment` event | + +## Example (as JSON) + +```json +{ + "id": 120, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "failed_payment", + "event_data": { + "amount_in_cents": 220, + "applied_amount": 194, + "memo": "memo0", + "payment_method": "cash", + "transaction_id": 78 + } +} +``` + diff --git a/doc/models/invoice-event-data.md b/doc/models/invoice-event-data.md deleted file mode 100644 index 98c9dc81..00000000 --- a/doc/models/invoice-event-data.md +++ /dev/null @@ -1,115 +0,0 @@ - -# Invoice Event Data - -The event data is the data that, when combined with the command, results in the output invoice found in the invoice field. - -## Structure - -`InvoiceEventData` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `str` | Optional | Unique identifier for the credit note application. It is generated automatically by Chargify and has the prefix "cdt_" followed by alphanumeric characters. | -| `credit_note_number` | `str` | Optional | A unique, identifying string that appears on the credit note and in places it is referenced. | -| `credit_note_uid` | `str` | Optional | Unique identifier for the credit note. It is generated automatically by Chargify and has the prefix "cn_" followed by alphanumeric characters. | -| `original_amount` | `str` | Optional | The full, original amount of the credit note. | -| `applied_amount` | `str` | Optional | The amount of the credit note applied to invoice. | -| `transaction_time` | `datetime` | Optional | The time the credit note was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" | -| `memo` | `str` | Optional | The credit note memo. | -| `role` | [`InvoiceRole1`](../../doc/models/invoice-role-1.md) | Optional | The role of the credit note (e.g. 'general') | -| `consolidated_invoice` | `bool` | Optional | Shows whether it was applied to consolidated invoice or not | -| `applied_credit_notes` | [`List[AppliedCreditNoteData]`](../../doc/models/applied-credit-note-data.md) | Optional | List of credit notes applied to children invoices (if consolidated invoice) | -| `debit_note_number` | `str` | Optional | A unique, identifying string that appears on the debit note and in places it is referenced. | -| `debit_note_uid` | `str` | Optional | Unique identifier for the debit note. It is generated automatically by Chargify and has the prefix "db_" followed by alphanumeric characters. | -| `consolidation_level` | [`InvoiceConsolidationLevel`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://chargify.zendesk.com/hc/en-us/articles/4407746391835). | -| `payment_method` | [Payment Method Apple Pay](../../doc/models/payment-method-apple-pay.md) \| [Payment Method Bank Account](../../doc/models/payment-method-bank-account.md) \| [Payment Method Credit Card](../../doc/models/payment-method-credit-card.md) \| [Payment Method External](../../doc/models/payment-method-external.md) \| [Payment Method Paypal](../../doc/models/payment-method-paypal.md) \| None | Optional | This is a container for any-of cases. | -| `transaction_id` | `int` | Optional | The Chargify id of the original payment | -| `parent_invoice_number` | `int` | Optional | For invoices with `consolidation_level` of `child`, this specifies the number of the parent (consolidated) invoice. | -| `remaining_prepayment_amount` | `str` | Optional | - | -| `prepayment` | `bool` | Optional | The flag that shows whether the original payment was a prepayment or not | -| `external` | `bool` | Optional | - | -| `from_collection_method` | `str` | Optional | The previous collection method of the invoice. | -| `to_collection_method` | `str` | Optional | The new collection method of the invoice. | -| `from_status` | `object` | Optional | - | -| `to_status` | `object` | Optional | - | -| `due_amount` | `str` | Optional | Amount due on the invoice, which is `total_amount - credit_amount - paid_amount`. | -| `total_amount` | `str` | Optional | The invoice total, which is `subtotal_amount - discount_amount + tax_amount`.' | -| `apply_credit` | `bool` | Optional | If true, credit was created and applied it to the invoice. | -| `credit_note_attributes` | [`CreditNote1`](../../doc/models/credit-note-1.md) | Optional | - | -| `payment_id` | `int` | Optional | The ID of the payment transaction to be refunded. | -| `refund_amount` | `str` | Optional | The amount of the refund. | -| `refund_id` | `int` | Optional | The ID of the refund transaction. | -| `is_advance_invoice` | `bool` | Optional | If true, the invoice is an advance invoice. | -| `reason` | `str` | Optional | The reason for the void. | -| `id` | `long\|int` | Optional | - | -| `site_id` | `int` | Optional | ID of the site to which the invoice belongs. | -| `customer_id` | `int` | Optional | ID of the customer to which the invoice belongs. | -| `subscription_id` | `int` | Optional | ID of the subscription that generated the invoice. | -| `number` | `str` | Optional | A unique, identifying string that appears on the invoice and in places the invoice is referenced.

While the UID is long and not appropriate to show to customers, the number is usually shorter and consumable by the customer and the merchant alike. | -| `sequence_number` | `int` | Optional | A monotonically increasing number assigned to invoices as they are created. This number is unique within a site and can be used to sort and order invoices. | -| `created_at` | `datetime` | Optional | - | -| `updated_at` | `datetime` | Optional | - | -| `issue_date` | `date` | Optional | Date the invoice was issued to the customer. This is the date that the invoice was made available for payment.

The format is `"YYYY-MM-DD"`. | -| `due_date` | `date` | Optional | Date the invoice is due.

The format is `"YYYY-MM-DD"`. | -| `paid_date` | `date` | Optional | Date the invoice became fully paid.

If partial payments are applied to the invoice, this date will not be present until payment has been made in full.

The format is `"YYYY-MM-DD"`. | -| `status` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The current status of the invoice. See [Invoice Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405078794253-Introduction-to-Invoices#invoice-statuses) for more. | -| `parent_invoice_id` | `int` | Optional | - | -| `collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | -| `payment_instructions` | `str` | Optional | A message that is printed on the invoice when it is marked for remittance collection. It is intended to describe to the customer how they may make payment, and is configured by the merchant. | -| `currency` | `str` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | -| `parent_invoice_uid` | `str` | Optional | For invoices with `consolidation_level` of `child`, this specifies the UID of the parent (consolidated) invoice. | -| `subscription_group_id` | `int` | Optional | - | -| `group_primary_subscription_id` | `int` | Optional | For invoices with `consolidation_level` of `parent`, this specifies the ID of the subscription which was the primary subscription of the subscription group that generated the invoice. | -| `product_name` | `str` | Optional | The name of the product subscribed when the invoice was generated. | -| `product_family_name` | `str` | Optional | The name of the product family subscribed when the invoice was generated. | -| `seller` | [`InvoiceSeller`](../../doc/models/invoice-seller.md) | Optional | Information about the seller (merchant) listed on the masthead of the invoice. | -| `customer` | [`InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the invoiced subscription. | -| `payer` | [`InvoicePayer`](../../doc/models/invoice-payer.md) | Optional | - | -| `recipient_emails` | `List[str]` | Optional | **Constraints**: *Maximum Items*: `5` | -| `net_terms` | `int` | Optional | - | -| `billing_address` | [`BillingAddress`](../../doc/models/billing-address.md) | Optional | - | -| `shipping_address` | [`ShippingAddress`](../../doc/models/shipping-address.md) | Optional | - | -| `subtotal_amount` | `str` | Optional | Subtotal of the invoice, which is the sum of all line items before discounts or taxes. | -| `discount_amount` | `str` | Optional | Total discount applied to the invoice. | -| `tax_amount` | `str` | Optional | Total tax on the invoice. | -| `credit_amount` | `str` | Optional | The amount of credit (from credit notes) applied to this invoice.

Credits offset the amount due from the customer. | -| `paid_amount` | `str` | Optional | The amount paid on the invoice by the customer. | -| `line_items` | [`List[InvoiceLineItem1]`](../../doc/models/invoice-line-item-1.md) | Optional | Line items on the invoice. | -| `discounts` | [`List[InvoiceDiscount]`](../../doc/models/invoice-discount.md) | Optional | - | -| `taxes` | [`List[InvoiceTax]`](../../doc/models/invoice-tax.md) | Optional | - | -| `credits` | [`List[InvoiceCredit]`](../../doc/models/invoice-credit.md) | Optional | - | -| `refunds` | [`List[InvoiceRefund]`](../../doc/models/invoice-refund.md) | Optional | - | -| `payments` | [`List[InvoicePayment]`](../../doc/models/invoice-payment.md) | Optional | - | -| `custom_fields` | [`List[InvoiceCustomField]`](../../doc/models/invoice-custom-field.md) | Optional | - | -| `display_settings` | [`InvoiceDisplaySettings`](../../doc/models/invoice-display-settings.md) | Optional | - | -| `public_url` | `str` | Optional | The public URL of the invoice | -| `previous_balance_data` | [`InvoicePreviousBalance`](../../doc/models/invoice-previous-balance.md) | Optional | - | -| `gateway_trans_id` | `str` | Optional | Identifier for the transaction within the payment gateway. | -| `amount` | `str` | Optional | The monetary value associated with the linked payment, expressed in dollars. | -| `amount_in_cents` | `int` | Optional | The monetary value of the payment, expressed in cents. | -| `origin_credit_note_uid` | `str` | Optional | Unique identifier for the connected credit note. It is generated automatically by Chargify and has the prefix "cn_" followed by alphanumeric characters.

While the UID is long and not appropriate to show to customers, the number is usually shorter and consumable by the customer and the merchant alike. | -| `origin_credit_note_number` | `str` | Optional | A unique, identifying string of the connected credit note. | -| `applied_date` | `date` | Optional | Debit notes are applied to invoices to offset invoiced amounts - they adjust the amount due. This field is the date the debit note document became fully applied to the invoice.

The format is "YYYY-MM-DD". | -| `remaining_amount` | `str` | Optional | The amount of the credit note remaining to be applied to invoices, which is `total_amount - applied_amount`. | -| `applications` | [`List[CreditNoteApplication]`](../../doc/models/credit-note-application.md) | Optional | - | -| `origin_invoices` | [`List[OriginInvoice]`](../../doc/models/origin-invoice.md) | Optional | An array of origin invoices for the credit note. Learn more about [Origin Invoice from our docs](https://chargify.zendesk.com/hc/en-us/articles/4407753036699#origin-invoices) | -| `chargeback_status` | [`ChargebackStatus`](../../doc/models/chargeback-status.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "collection_method": "automatic", - "uid": "uid0", - "credit_note_number": "credit_note_number6", - "credit_note_uid": "credit_note_uid6", - "original_amount": "original_amount4", - "applied_amount": "applied_amount8" -} -``` - diff --git a/doc/models/invoice-event-payment-1.md b/doc/models/invoice-event-payment-1.md deleted file mode 100644 index 0ee1679b..00000000 --- a/doc/models/invoice-event-payment-1.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Invoice Event Payment 1 - -A nested data structure detailing the method of payment - -## Structure - -`InvoiceEventPayment1` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `mtype` | `str` | Optional | - | -| `masked_account_number` | `str` | Required | - | -| `masked_routing_number` | `str` | Required | - | -| `card_brand` | `str` | Required | - | -| `card_expiration` | `str` | Optional | - | -| `last_four` | `str` | Optional | - | -| `masked_card_number` | `str` | Required | - | -| `details` | `str` | Required | - | -| `kind` | `str` | Required | - | -| `memo` | `str` | Required | - | -| `email` | `str` | Required | - | - -## Example (as JSON) - -```json -{ - "type": "Invoice Event Payment1", - "masked_account_number": "masked_account_number4", - "masked_routing_number": "masked_routing_number4", - "card_brand": "card_brand8", - "card_expiration": "card_expiration4", - "last_four": "last_four2", - "masked_card_number": "masked_card_number6", - "details": "details8", - "kind": "kind6", - "memo": "memo2", - "email": "email8" -} -``` - diff --git a/doc/models/invoice-event-payment.md b/doc/models/invoice-event-payment.md deleted file mode 100644 index cf15b409..00000000 --- a/doc/models/invoice-event-payment.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Invoice Event Payment - -A nested data structure detailing the method of payment - -## Structure - -`InvoiceEventPayment` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `mtype` | `str` | Optional | - | -| `masked_account_number` | `str` | Optional | - | -| `masked_routing_number` | `str` | Optional | - | -| `card_brand` | `str` | Optional | - | -| `card_expiration` | `str` | Optional | - | -| `last_four` | `str` | Optional | - | -| `masked_card_number` | `str` | Optional | - | -| `details` | `str` | Optional | - | -| `kind` | `str` | Optional | - | -| `memo` | `str` | Optional | - | -| `email` | `str` | Optional | - | - -## Example (as JSON) - -```json -{ - "type": "Invoice Event Payment", - "masked_account_number": "masked_account_number8", - "masked_routing_number": "masked_routing_number8", - "card_brand": "card_brand4", - "card_expiration": "card_expiration2" -} -``` - diff --git a/doc/models/invoice-event.md b/doc/models/invoice-event.md deleted file mode 100644 index 0d6e8668..00000000 --- a/doc/models/invoice-event.md +++ /dev/null @@ -1,55 +0,0 @@ - -# Invoice Event - -## Structure - -`InvoiceEvent` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `id` | `long\|int` | Optional | - | -| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Optional | Invoice Event Type | -| `event_data` | [Apply Credit Note Event Data](../../doc/models/apply-credit-note-event-data.md) \| [Apply Debit Note Event Data](../../doc/models/apply-debit-note-event-data.md) \| [Apply Payment Event Data](../../doc/models/apply-payment-event-data.md) \| [Change Invoice Collection Method Event Data](../../doc/models/change-invoice-collection-method-event-data.md) \| [Issue Invoice Event Data](../../doc/models/issue-invoice-event-data.md) \| [Refund Invoice Event Data](../../doc/models/refund-invoice-event-data.md) \| [Remove Payment Event Data](../../doc/models/remove-payment-event-data.md) \| [Void Invoice Event Data](../../doc/models/void-invoice-event-data.md) \| [Void Remainder Event Data](../../doc/models/void-remainder-event-data.md) \| [Invoice](../../doc/models/invoice.md) \| [Change Invoice Status Event Data](../../doc/models/change-invoice-status-event-data.md) \| [Failed Payment Event Data](../../doc/models/failed-payment-event-data.md) \| [Debit Note](../../doc/models/debit-note.md) \| [Credit Note](../../doc/models/credit-note.md) \| [Change Chargeback Status Event Data](../../doc/models/change-chargeback-status-event-data.md) \| None | Optional | This is a container for any-of cases. | -| `timestamp` | `datetime` | Optional | - | -| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "id": 78, - "event_type": "create_debit_note", - "event_data": { - "uid": "uid2", - "credit_note_number": "credit_note_number4", - "credit_note_uid": "credit_note_uid4", - "original_amount": "original_amount6", - "applied_amount": "applied_amount6", - "transaction_time": "2016-03-13T12:52:32.123Z", - "memo": "memo6", - "role": "role4", - "consolidated_invoice": false, - "applied_credit_notes": [ - { - "uid": "uid4", - "number": "number8" - }, - { - "uid": "uid4", - "number": "number8" - } - ] - }, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - } -} -``` - diff --git a/doc/models/invoice-line-item-1.md b/doc/models/invoice-line-item-1.md deleted file mode 100644 index cad1f941..00000000 --- a/doc/models/invoice-line-item-1.md +++ /dev/null @@ -1,47 +0,0 @@ - -# Invoice Line Item 1 - -## Structure - -`InvoiceLineItem1` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `uid` | `str` | Optional | Unique identifier for the line item. Useful when cross-referencing the line against individual discounts in the `discounts` or `taxes` lists. | -| `title` | `str` | Optional | A short descriptor for the charge or item represented by this line. | -| `description` | `str` | Optional | Detailed description for the charge or item represented by this line. May include proration details in plain text.

Note: this string may contain line breaks that are hints for the best display format on the invoice. | -| `quantity` | `str` | Optional | The quantity or count of units billed by the line item.

This is a decimal number represented as a string. (See "About Decimal Numbers".) | -| `unit_price` | `str` | Optional | The price per unit for the line item.

When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. | -| `subtotal_amount` | `str` | Optional | The line subtotal, generally calculated as `quantity * unit_price`. This is the canonical amount of record for the line - when rounding differences are in play, `subtotal_amount` takes precedence over the value derived from `quantity * unit_price` (which may not have the proper precision to exactly equal this amount). | -| `discount_amount` | `str` | Optional | The approximate discount applied to just this line.

The value is approximated in cases where rounding errors make it difficult to apportion exactly a total discount among many lines. Several lines may have been summed prior to applying the discount to arrive at `discount_amount` for the invoice - backing that out to the discount on a single line may introduce rounding or precision errors. | -| `tax_amount` | `str` | Optional | The approximate tax applied to just this line.

The value is approximated in cases where rounding errors make it difficult to apportion exactly a total tax among many lines. Several lines may have been summed prior to applying the tax rate to arrive at `tax_amount` for the invoice - backing that out to the tax on a single line may introduce rounding or precision errors. | -| `total_amount` | `str` | Optional | The non-canonical total amount for the line.

`subtotal_amount` is the canonical amount for a line. The invoice `total_amount` is derived from the sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to rounding or precision errors, the sum of line `total_amount`s may not equal the invoice `total_amount`. | -| `tiered_unit_price` | `bool` | Optional | When `true`, indicates that the actual pricing scheme for the line was tiered, so the `unit_price` shown is the blended average for all units. | -| `period_range_start` | `date` | Optional | Start date for the period covered by this line. The format is `"YYYY-MM-DD"`.

* For periodic charges paid in advance, this date will match the billing date, and the end date will be in the future.
* For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the previous billing, and the end date will be the current billing date.
* For non-periodic charges, this date and the end date will match. | -| `period_range_end` | `date` | Optional | End date for the period covered by this line. The format is `"YYYY-MM-DD"`.

* For periodic charges paid in advance, this date will match the next (future) billing date.
* For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the current billing date.
* For non-periodic charges, this date and the start date will match. | -| `transaction_id` | `int` | Optional | - | -| `product_id` | `int` | Optional | The ID of the product subscribed when the charge was made.

This may be set even for component charges, so true product-only (non-component) charges will also have a nil `component_id`. | -| `product_version` | `int` | Optional | The version of the product subscribed when the charge was made. | -| `component_id` | `int` | Optional | The ID of the component being billed. Will be `nil` for non-component charges. | -| `price_point_id` | `int` | Optional | The price point ID of the component being billed. Will be `nil` for non-component charges. | -| `hide` | `bool` | Optional | - | -| `component_cost_data` | [`InvoiceLineItemComponentCostData`](../../doc/models/invoice-line-item-component-cost-data.md) | Optional | - | -| `product_price_point_id` | `int` | Optional | The price point ID of the line item's product | -| `custom_item` | `bool` | Optional | - | -| `kind` | `str` | Optional | - | -| `billing_schedule_item_id` | `int` | Optional | - | - -## Example (as JSON) - -```json -{ - "uid": "uid8", - "title": "title4", - "description": "description8", - "quantity": "quantity4", - "unit_price": "unit_price6" -} -``` - diff --git a/doc/models/invoice-response.md b/doc/models/invoice-response.md index 19560500..eca1065d 100644 --- a/doc/models/invoice-response.md +++ b/doc/models/invoice-response.md @@ -19,7 +19,6 @@ "issue_date": "2024-01-01", "due_date": "2024-01-01", "paid_date": "2024-01-01", - "collection_method": "automatic", "id": 166, "uid": "uid6", "site_id": 92, diff --git a/doc/models/invoice-role-1.md b/doc/models/invoice-role-1.md deleted file mode 100644 index cffb8a93..00000000 --- a/doc/models/invoice-role-1.md +++ /dev/null @@ -1,24 +0,0 @@ - -# Invoice Role 1 - -The role of the credit note (e.g. 'general') - -## Enumeration - -`InvoiceRole1` - -## Fields - -| Name | -| --- | -| `UNSET` | -| `SIGNUP` | -| `RENEWAL` | -| `USAGE` | -| `REACTIVATION` | -| `PRORATION` | -| `MIGRATION` | -| `ADHOC` | -| `BACKPORT` | -| `BACKPORTBALANCERECONCILIATION` | - diff --git a/doc/models/invoice.md b/doc/models/invoice.md index 8eaf0585..da1f5a9d 100644 --- a/doc/models/invoice.md +++ b/doc/models/invoice.md @@ -25,7 +25,7 @@ | `status` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The current status of the invoice. See [Invoice Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405078794253-Introduction-to-Invoices#invoice-statuses) for more. | | `role` | [`InvoiceRole`](../../doc/models/invoice-role.md) | Optional | - | | `parent_invoice_id` | `int` | Optional | - | -| `collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | +| `collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `payment_instructions` | `str` | Optional | A message that is printed on the invoice when it is marked for remittance collection. It is intended to describe to the customer how they may make payment, and is configured by the merchant. | | `currency` | `str` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | | `consolidation_level` | [`InvoiceConsolidationLevel`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://chargify.zendesk.com/hc/en-us/articles/4407746391835). | @@ -69,7 +69,6 @@ "issue_date": "2024-01-01", "due_date": "2024-01-01", "paid_date": "2024-01-01", - "collection_method": "automatic", "id": 252, "uid": "uid0", "site_id": 178, diff --git a/doc/models/issue-invoice-event.md b/doc/models/issue-invoice-event.md new file mode 100644 index 00000000..d681fac4 --- /dev/null +++ b/doc/models/issue-invoice-event.md @@ -0,0 +1,44 @@ + +# Issue Invoice Event + +## Structure + +`IssueInvoiceEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'issue_invoice'` | +| `event_data` | [`IssueInvoiceEventData`](../../doc/models/issue-invoice-event-data.md) | Required | Example schema for an `issue_invoice` event | + +## Example (as JSON) + +```json +{ + "id": 130, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "issue_invoice", + "event_data": { + "consolidation_level": "child", + "from_status": "paid", + "to_status": "paid", + "due_amount": "due_amount8", + "total_amount": "total_amount2" + } +} +``` + diff --git a/doc/models/list-invoice-events-response.md b/doc/models/list-invoice-events-response.md index 18eb964a..e87a0c5c 100644 --- a/doc/models/list-invoice-events-response.md +++ b/doc/models/list-invoice-events-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `events` | [`List[InvoiceEvent]`](../../doc/models/invoice-event.md) | Optional | - | +| `events` | List[[Apply Credit Note Event](../../doc/models/apply-credit-note-event.md) \| [Apply Debit Note Event](../../doc/models/apply-debit-note-event.md) \| [Apply Payment Event](../../doc/models/apply-payment-event.md) \| [Backport Invoice Event](../../doc/models/backport-invoice-event.md) \| [Change Chargeback Status Event](../../doc/models/change-chargeback-status-event.md) \| [Change Invoice Collection Method Event](../../doc/models/change-invoice-collection-method-event.md) \| [Change Invoice Status Event](../../doc/models/change-invoice-status-event.md) \| [Create Credit Note Event](../../doc/models/create-credit-note-event.md) \| [Create Debit Note Event](../../doc/models/create-debit-note-event.md) \| [Failed Payment Event](../../doc/models/failed-payment-event.md) \| [Issue Invoice Event](../../doc/models/issue-invoice-event.md) \| [Refund Invoice Event](../../doc/models/refund-invoice-event.md) \| [Remove Payment Event](../../doc/models/remove-payment-event.md) \| [Void Invoice Event](../../doc/models/void-invoice-event.md) \| [Void Remainder Event](../../doc/models/void-remainder-event.md)] \| None | Optional | - | | `page` | `int` | Optional | - | | `per_page` | `int` | Optional | - | | `total_pages` | `int` | Optional | - | @@ -20,36 +20,40 @@ { "events": [ { - "id": 68, - "event_type": "create_debit_note", + "event_type": "apply_credit_note", + "id": 214, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, "event_data": { - "uid": "uid2", - "credit_note_number": "credit_note_number4", - "credit_note_uid": "credit_note_uid4", - "original_amount": "original_amount6", - "applied_amount": "applied_amount6", + "uid": "uid6", + "credit_note_number": "credit_note_number0", + "credit_note_uid": "credit_note_uid0", + "original_amount": "original_amount0", + "applied_amount": "applied_amount2", "transaction_time": "2016-03-13T12:52:32.123Z", - "memo": "memo6", - "role": "role4", + "memo": "memo0", + "role": "role0", "consolidated_invoice": false, "applied_credit_notes": [ { "uid": "uid4", "number": "number8" }, + { + "uid": "uid4", + "number": "number8" + }, { "uid": "uid4", "number": "number8" } ] - }, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 } } ], diff --git a/doc/models/list-invoices-response.md b/doc/models/list-invoices-response.md index 0403e1c4..48a670da 100644 --- a/doc/models/list-invoices-response.md +++ b/doc/models/list-invoices-response.md @@ -20,7 +20,6 @@ "issue_date": "2024-01-01", "due_date": "2024-01-01", "paid_date": "2024-01-01", - "collection_method": "automatic", "id": 196, "uid": "uid6", "site_id": 122, diff --git a/doc/models/payment-method-apple-pay.md b/doc/models/payment-method-apple-pay.md index 73cd9118..36edc23a 100644 --- a/doc/models/payment-method-apple-pay.md +++ b/doc/models/payment-method-apple-pay.md @@ -15,7 +15,7 @@ ```json { - "type": "credit_card" + "type": "apple_pay" } ``` diff --git a/doc/models/payment-method-bank-account.md b/doc/models/payment-method-bank-account.md index 3791f7cf..796fabac 100644 --- a/doc/models/payment-method-bank-account.md +++ b/doc/models/payment-method-bank-account.md @@ -19,7 +19,7 @@ { "masked_account_number": "masked_account_number2", "masked_routing_number": "masked_routing_number2", - "type": "paypal_account" + "type": "bank_account" } ``` diff --git a/doc/models/payment-method-credit-card.md b/doc/models/payment-method-credit-card.md index 89b10df1..eddc8982 100644 --- a/doc/models/payment-method-credit-card.md +++ b/doc/models/payment-method-credit-card.md @@ -20,10 +20,10 @@ ```json { "card_brand": "card_brand4", - "card_expiration": "card_expiration2", - "last_four": "last_four4", "masked_card_number": "masked_card_number0", - "type": "external" + "type": "credit_card", + "card_expiration": "card_expiration2", + "last_four": "last_four4" } ``` diff --git a/doc/models/payment-method-external.md b/doc/models/payment-method-external.md index 629ff79a..fc2ec0f8 100644 --- a/doc/models/payment-method-external.md +++ b/doc/models/payment-method-external.md @@ -21,7 +21,7 @@ "details": "details4", "kind": "kind2", "memo": "memo8", - "type": "bank_account" + "type": "external" } ``` diff --git a/doc/models/payment-method-paypal.md b/doc/models/payment-method-paypal.md index 0dc9e875..955a742e 100644 --- a/doc/models/payment-method-paypal.md +++ b/doc/models/payment-method-paypal.md @@ -17,7 +17,7 @@ ```json { "email": "email2", - "type": "bank_account" + "type": "paypal_account" } ``` diff --git a/doc/models/price-point.md b/doc/models/price-point.md deleted file mode 100644 index c710634f..00000000 --- a/doc/models/price-point.md +++ /dev/null @@ -1,43 +0,0 @@ - -# Price Point - -## Structure - -`PricePoint` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `str` | Optional | - | -| `handle` | `str` | Optional | - | -| `pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | -| `prices` | [`List[Price]`](../../doc/models/price.md) | Optional | - | -| `use_site_exchange_rate` | `bool` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
**Default**: `True` | -| `tax_included` | `bool` | Optional | Whether or not the price point includes tax | -| `interval` | `int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | -| `interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this price point, either month or day. This property is only available for sites with Multifrequency enabled. | -| `overage_pricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Optional | - | -| `rollover_prepaid_remainder` | `bool` | Optional | Boolean which controls whether or not remaining units should be rolled over to the next period | -| `renew_prepaid_allocation` | `bool` | Optional | Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period | -| `expiration_interval` | `float` | Optional | (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire | -| `expiration_interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Optional | - | - -## Example (as JSON) - -```json -{ - "use_site_exchange_rate": true, - "name": "name0", - "handle": "handle6", - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] -} -``` - diff --git a/doc/models/proforma-invoice.md b/doc/models/proforma-invoice.md index 7763bb31..c319cbd1 100644 --- a/doc/models/proforma-invoice.md +++ b/doc/models/proforma-invoice.md @@ -18,7 +18,7 @@ | `created_at` | `datetime` | Optional | - | | `delivery_date` | `date` | Optional | - | | `status` | [`ProformaInvoiceStatus`](../../doc/models/proforma-invoice-status.md) | Optional | - | -| `collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | +| `collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `payment_instructions` | `str` | Optional | - | | `currency` | `str` | Optional | - | | `consolidation_level` | [`InvoiceConsolidationLevel`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://chargify.zendesk.com/hc/en-us/articles/4407746391835). | @@ -50,7 +50,6 @@ ```json { - "collection_method": "automatic", "uid": "uid6", "site_id": 196, "customer_id": 52, diff --git a/doc/models/refund-invoice-event.md b/doc/models/refund-invoice-event.md new file mode 100644 index 00000000..6df8ed29 --- /dev/null +++ b/doc/models/refund-invoice-event.md @@ -0,0 +1,54 @@ + +# Refund Invoice Event + +## Structure + +`RefundInvoiceEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'refund_invoice'` | +| `event_data` | [`RefundInvoiceEventData`](../../doc/models/refund-invoice-event-data.md) | Required | Example schema for an `refund_invoice` event | + +## Example (as JSON) + +```json +{ + "id": 54, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "refund_invoice", + "event_data": { + "apply_credit": false, + "consolidation_level": "child", + "credit_note_attributes": { + "uid": "uid2", + "site_id": 72, + "customer_id": 184, + "subscription_id": 0, + "number": "number0" + }, + "memo": "memo0", + "original_amount": "original_amount0", + "payment_id": 204, + "refund_amount": "refund_amount8", + "refund_id": 248, + "transaction_time": "2016-03-13T12:52:32.123Z" + } +} +``` + diff --git a/doc/models/refund.md b/doc/models/refund.md deleted file mode 100644 index d96e9ff9..00000000 --- a/doc/models/refund.md +++ /dev/null @@ -1,31 +0,0 @@ - -# Refund - -## Structure - -`Refund` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `amount` | `str` | Optional | The amount to be refunded in decimal format as a string. Example: "10.50". Must not exceed the remaining refundable balance of the payment. | -| `memo` | `str` | Optional | A description that will be attached to the refund | -| `payment_id` | `int` | Optional | The ID of the payment to be refunded | -| `external` | `bool` | Optional | Flag that marks refund as external (no money is returned to the customer). Defaults to `false`. | -| `apply_credit` | `bool` | Optional | If set to true, creates credit and applies it to an invoice. Defaults to `false`. | -| `void_invoice` | `bool` | Optional | If `apply_credit` set to false and refunding full amount, if `void_invoice` set to true, invoice will be voided after refund. Defaults to `false`. | -| `segment_uids` | List[str] \| str \| None | Optional | This is a container for one-of cases. | - -## Example (as JSON) - -```json -{ - "amount": "amount8", - "memo": "memo0", - "payment_id": 130, - "external": false, - "apply_credit": false -} -``` - diff --git a/doc/models/remove-payment-event-data.md b/doc/models/remove-payment-event-data.md index 4a2aea0e..9e64ceb1 100644 --- a/doc/models/remove-payment-event-data.md +++ b/doc/models/remove-payment-event-data.md @@ -25,13 +25,13 @@ Example schema for an `remove_payment` event { "transaction_id": 180, "memo": "memo0", - "original_amount": "original_amount0", "applied_amount": "applied_amount2", "transaction_time": "2016-03-13T12:52:32.123Z", "payment_method": { "type": "apple_pay" }, - "prepayment": false + "prepayment": false, + "original_amount": "original_amount0" } ``` diff --git a/doc/models/remove-payment-event.md b/doc/models/remove-payment-event.md new file mode 100644 index 00000000..b8a8e0fa --- /dev/null +++ b/doc/models/remove-payment-event.md @@ -0,0 +1,48 @@ + +# Remove Payment Event + +## Structure + +`RemovePaymentEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'remove_payment'` | +| `event_data` | [`RemovePaymentEventData`](../../doc/models/remove-payment-event-data.md) | Required | Example schema for an `remove_payment` event | + +## Example (as JSON) + +```json +{ + "id": 236, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "remove_payment", + "event_data": { + "transaction_id": 78, + "memo": "memo0", + "applied_amount": "applied_amount2", + "transaction_time": "2016-03-13T12:52:32.123Z", + "payment_method": { + "type": "apple_pay" + }, + "prepayment": false, + "original_amount": "original_amount0" + } +} +``` + diff --git a/doc/models/seller.md b/doc/models/seller.md deleted file mode 100644 index 4a61860f..00000000 --- a/doc/models/seller.md +++ /dev/null @@ -1,33 +0,0 @@ - -# Seller - -## Structure - -`Seller` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `name` | `str` | Optional | - | -| `address` | [`InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | - | -| `phone` | `str` | Optional | - | -| `logo_url` | `str` | Optional | - | - -## Example (as JSON) - -```json -{ - "name": "name6", - "address": { - "street": "street6", - "line2": "line20", - "city": "city6", - "state": "state2", - "zip": "zip0" - }, - "phone": "phone6", - "logo_url": "logo_url4" -} -``` - diff --git a/doc/models/shipping-address.md b/doc/models/shipping-address.md deleted file mode 100644 index eec71e90..00000000 --- a/doc/models/shipping-address.md +++ /dev/null @@ -1,30 +0,0 @@ - -# Shipping Address - -## Structure - -`ShippingAddress` - -## Fields - -| Name | Type | Tags | Description | -| --- | --- | --- | --- | -| `street` | `str` | Optional | - | -| `line_2` | `str` | Optional | - | -| `city` | `str` | Optional | - | -| `state` | `str` | Optional | - | -| `zip` | `str` | Optional | - | -| `country` | `str` | Optional | - | - -## Example (as JSON) - -```json -{ - "street": "street0", - "line2": "line24", - "city": "city0", - "state": "state4", - "zip": "zip6" -} -``` - diff --git a/doc/models/subscription-group-response.md b/doc/models/subscription-group-response.md index 39b36d1a..7a1b1923 100644 --- a/doc/models/subscription-group-response.md +++ b/doc/models/subscription-group-response.md @@ -16,7 +16,6 @@ ```json { "subscription_group": { - "payment_collection_method": "automatic", "customer_id": 220, "payment_profile": { "id": 44, @@ -24,6 +23,7 @@ "last_name": "last_name2", "masked_card_number": "masked_card_number2" }, + "payment_collection_method": "prepaid", "subscription_ids": [ 74, 75 diff --git a/doc/models/subscription-group-signup-request.md b/doc/models/subscription-group-signup-request.md index 59f2d41d..3258d8fb 100644 --- a/doc/models/subscription-group-signup-request.md +++ b/doc/models/subscription-group-signup-request.md @@ -16,7 +16,6 @@ ```json { "subscription_group": { - "payment_collection_method": "automatic", "subscriptions": [ { "metafields": { @@ -33,6 +32,7 @@ "payment_profile_id": 128, "payer_id": 150, "payer_reference": "payer_reference6", + "payment_collection_method": "prepaid", "payer_attributes": { "first_name": "first_name2", "last_name": "last_name0", diff --git a/doc/models/subscription-group-signup-response.md b/doc/models/subscription-group-signup-response.md index 8e53fa7b..59021c0d 100644 --- a/doc/models/subscription-group-signup-response.md +++ b/doc/models/subscription-group-signup-response.md @@ -19,13 +19,12 @@ | `state` | [`SubscriptionState`](../../doc/models/subscription-state.md) | Optional | The state of a subscription.

* **Live States**
* `active` - A normal, active subscription. It is not in a trial and is paid and up to date.
* `assessing` - An internal (transient) state that indicates a subscription is in the middle of periodic assessment. Do not base any access decisions in your app on this state, as it may not always be exposed.
* `pending` - An internal (transient) state that indicates a subscription is in the creation process. Do not base any access decisions in your app on this state, as it may not always be exposed.
* `trialing` - A subscription in trialing state has a valid trial subscription. This type of subscription may transition to active once payment is received when the trial has ended. Otherwise, it may go to a Problem or End of Life state.
* `paused` - An internal state that indicates that your account with Advanced Billing is in arrears.
* **Problem States**
* `past_due` - Indicates that the most recent payment has failed, and payment is past due for this subscription. If you have enabled our automated dunning, this subscription will be in the dunning process (additional status and callbacks from the dunning process will be available in the future). If you are handling dunning and payment updates yourself, you will want to use this state to initiate a payment update from your customers.
* `soft_failure` - Indicates that normal assessment/processing of the subscription has failed for a reason that cannot be fixed by the Customer. For example, a Soft Fail may result from a timeout at the gateway or incorrect credentials on your part. The subscriptions should be retried automatically. An interface is being built for you to review problems resulting from these events to take manual action when needed.
* `unpaid` - Indicates an unpaid subscription. A subscription is marked unpaid if the retry period expires and you have configured your [Dunning](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405505141005) settings to have a Final Action of `mark the subscription unpaid`.
* **End of Life States**
* `canceled` - Indicates a canceled subscription. This may happen at your request (via the API or the web interface) or due to the expiration of the [Dunning](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405505141005) process without payment. See the [Reactivation](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404559291021) documentation for info on how to restart a canceled subscription.
While a subscription is canceled, its period will not advance, it will not accrue any new charges, and Advanced Billing will not attempt to collect the overdue balance.
* `expired` - Indicates a subscription that has expired due to running its normal life cycle. Some products may be configured to have an expiration period. An expired subscription then is one that stayed active until it fulfilled its full period.
* `failed_to_create` - Indicates that signup has failed. (You may see this state in a signup_failure webhook.)
* `on_hold` - Indicates that a subscription’s billing has been temporarily stopped. While it is expected that the subscription will resume and return to active status, this is still treated as an “End of Life” state because the customer is not paying for services during this time.
* `suspended` - Indicates that a prepaid subscription has used up all their prepayment balance. If a prepayment is applied, it will return to an active state.
* `trial_ended` - A subscription in a trial_ended state is a subscription that completed a no-obligation trial and did not have a card on file at the expiration of the trial period. See [Product Pricing – No Obligation Trials](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405246782221) for more details.

See [Subscription States](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404222005773) for more info about subscription states and state transitions. | | `cancel_at_end_of_period` | `bool` | Optional | - | | `subscriptions` | [`List[SubscriptionGroupItem]`](../../doc/models/subscription-group-item.md) | Optional | - | -| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | +| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | ## Example (as JSON) ```json { - "payment_collection_method": "automatic", "uid": "uid8", "scheme": 28, "customer_id": 48, diff --git a/doc/models/subscription-group-signup.md b/doc/models/subscription-group-signup.md index bbd73c4b..ae58394a 100644 --- a/doc/models/subscription-group-signup.md +++ b/doc/models/subscription-group-signup.md @@ -12,7 +12,7 @@ | `payment_profile_id` | `int` | Optional | - | | `payer_id` | `int` | Optional | - | | `payer_reference` | `str` | Optional | - | -| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | +| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `payer_attributes` | [`PayerAttributes`](../../doc/models/payer-attributes.md) | Optional | - | | `credit_card_attributes` | [`SubscriptionGroupCreditCard`](../../doc/models/subscription-group-credit-card.md) | Optional | - | | `bank_account_attributes` | [`SubscriptionGroupBankAccount`](../../doc/models/subscription-group-bank-account.md) | Optional | - | @@ -22,7 +22,6 @@ ```json { - "payment_collection_method": "automatic", "subscriptions": [ { "metafields": { @@ -39,6 +38,7 @@ "payment_profile_id": 42, "payer_id": 64, "payer_reference": "payer_reference8", + "payment_collection_method": "automatic", "payer_attributes": { "first_name": "first_name2", "last_name": "last_name0", diff --git a/doc/models/subscription-group.md b/doc/models/subscription-group.md index 6ffec67f..17331bfb 100644 --- a/doc/models/subscription-group.md +++ b/doc/models/subscription-group.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | | `customer_id` | `int` | Optional | - | | `payment_profile` | [`SubscriptionGroupPaymentProfile`](../../doc/models/subscription-group-payment-profile.md) | Optional | - | -| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | +| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `subscription_ids` | `List[int]` | Optional | - | | `created_at` | `datetime` | Optional | - | @@ -19,7 +19,6 @@ ```json { - "payment_collection_method": "automatic", "customer_id": 36, "payment_profile": { "id": 44, @@ -27,6 +26,7 @@ "last_name": "last_name2", "masked_card_number": "masked_card_number2" }, + "payment_collection_method": "prepaid", "subscription_ids": [ 146, 147, diff --git a/doc/models/subscription.md b/doc/models/subscription.md index 36bf68bc..d4860321 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -34,7 +34,7 @@ | `delayed_cancel_at` | `datetime` | Optional | Timestamp for when the subscription is currently set to cancel. | | `coupon_code` | `str` | Optional | (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. | | `snap_day` | `str` | Optional | The day of the month that the subscription will charge according to calendar billing rules, if used. | -| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `'automatic'` | +| `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `customer` | [`Customer`](../../doc/models/customer.md) | Optional | - | | `product` | [`Product`](../../doc/models/product.md) | Optional | - | | `credit_card` | [`CreditCardPaymentProfile`](../../doc/models/credit-card-payment-profile.md) | Optional | - | @@ -76,7 +76,6 @@ ```json { - "payment_collection_method": "automatic", "credit_card": { "id": 10088716, "first_name": "Test", diff --git a/doc/models/void-invoice-event.md b/doc/models/void-invoice-event.md new file mode 100644 index 00000000..8e21548d --- /dev/null +++ b/doc/models/void-invoice-event.md @@ -0,0 +1,51 @@ + +# Void Invoice Event + +## Structure + +`VoidInvoiceEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'void_invoice'` | +| `event_data` | [`VoidInvoiceEventData`](../../doc/models/void-invoice-event-data.md) | Required | Example schema for an `void_invoice` event | + +## Example (as JSON) + +```json +{ + "id": 16, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "void_invoice", + "event_data": { + "credit_note_attributes": { + "uid": "uid2", + "site_id": 72, + "customer_id": 184, + "subscription_id": 0, + "number": "number0" + }, + "memo": "memo0", + "applied_amount": "applied_amount2", + "transaction_time": "2016-03-13T12:52:32.123Z", + "is_advance_invoice": false, + "reason": "reason2" + } +} +``` + diff --git a/doc/models/void-remainder-event.md b/doc/models/void-remainder-event.md new file mode 100644 index 00000000..d731126f --- /dev/null +++ b/doc/models/void-remainder-event.md @@ -0,0 +1,49 @@ + +# Void Remainder Event + +## Structure + +`VoidRemainderEvent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `long\|int` | Required | - | +| `timestamp` | `datetime` | Required | - | +| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | +| `event_type` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `'void_remainder'` | +| `event_data` | [`VoidRemainderEventData`](../../doc/models/void-remainder-event-data.md) | Required | Example schema for an `void_remainder` event | + +## Example (as JSON) + +```json +{ + "id": 128, + "timestamp": "2016-03-13T12:52:32.123Z", + "invoice": { + "issue_date": "2024-01-01", + "due_date": "2024-01-01", + "paid_date": "2024-01-01", + "id": 166, + "uid": "uid6", + "site_id": 92, + "customer_id": 204, + "subscription_id": 20 + }, + "event_type": "void_remainder", + "event_data": { + "credit_note_attributes": { + "uid": "uid2", + "site_id": 72, + "customer_id": 184, + "subscription_id": 0, + "number": "number0" + }, + "memo": "memo0", + "applied_amount": "applied_amount2", + "transaction_time": "2016-03-13T12:52:32.123Z" + } +} +``` + diff --git a/pyproject.toml b/pyproject.toml index 3d2b375a..55e941d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ requires-python = ">=3.7" keywords = ["Maxio", "Advaced Billing", "Payments", "Subscription"] authors = [{name = "Maxio SDK", email = "maxio-sdk@maxio.com"}] urls = {Homepage = "https://www.maxio.com/product/advanced-billing"} -dependencies = ["apimatic-core~=0.2.0", "apimatic-core-interfaces~=0.1.0", "apimatic-requests-client-adapter~=0.1.0", "enum34~=1.1, >=1.1.10", "deprecation~=2.1", "python-dateutil~=2.8.1", "jsonschema~=3.2.0"] +dependencies = ["apimatic-core~=0.2.0", "apimatic-core-interfaces~=0.1.0", "apimatic-requests-client-adapter~=0.1.0", "deprecation~=2.1", "python-dateutil~=2.8.1", "jsonschema~=3.2.0"] classifiers = [] [project.optional-dependencies] testutils = ["pytest>=7.2.2"] diff --git a/requirements.txt b/requirements.txt index df1ce0d1..eca41b15 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,5 @@ apimatic-core~=0.2.0 apimatic-core-interfaces~=0.1.0 apimatic-requests-client-adapter~=0.1.0 python-dateutil~=2.8.1 -enum34~=1.1, >=1.1.10 deprecation~=2.1 jsonschema~=3.2.0 diff --git a/tests/test_invoices.py b/tests/test_invoices.py index 4287a184..c7a220a5 100644 --- a/tests/test_invoices.py +++ b/tests/test_invoices.py @@ -32,12 +32,13 @@ from advancedbilling.models.credit_card_payment_profile import CreditCardPaymentProfile from advancedbilling.models.customer import Customer from advancedbilling.models.invoice import Invoice -from advancedbilling.models.invoice_event import InvoiceEvent from advancedbilling.models.invoice_event_type import InvoiceEventType +from advancedbilling.models.issue_invoice_event import IssueInvoiceEvent from advancedbilling.models.product import Product from advancedbilling.models.product_family import ProductFamily from advancedbilling.models.subscription import Subscription from advancedbilling.models.void_invoice import VoidInvoice +from advancedbilling.models.void_invoice_event import VoidInvoiceEvent from advancedbilling.models.void_invoice_request import VoidInvoiceRequest from .data import InitCases, InvoiceAssertCases @@ -200,9 +201,9 @@ def test_list_invoice_events_given_voided_invoice_then_return_void_invoice_event assert len(events) > 2 - event: InvoiceEvent for event in events: - assert event.event_type in (InvoiceEventType.ISSUE_INVOICE, InvoiceEventType.VOID_INVOICE) + assert event.event_type == InvoiceEventType.ISSUE_INVOICE and isinstance(event, IssueInvoiceEvent) or \ + event.event_type == InvoiceEventType.VOID_INVOICE and isinstance(event, VoidInvoiceEvent) subscriptions_controller.purge_subscription(subscription.id, customer.id) customers_controller.delete_customer(customer.id)