UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

233 lines (232 loc) 14.5 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * OpenPay API * super charge your subscription management. * * The version of the OpenAPI document: 1.2.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.instanceOfInvoiceExternal = instanceOfInvoiceExternal; exports.InvoiceExternalFromJSON = InvoiceExternalFromJSON; exports.InvoiceExternalFromJSONTyped = InvoiceExternalFromJSONTyped; exports.InvoiceExternalToJSON = InvoiceExternalToJSON; exports.InvoiceExternalToJSONTyped = InvoiceExternalToJSONTyped; const TaxIdSetting_1 = require("./TaxIdSetting"); const InvoiceStatusEnum_1 = require("./InvoiceStatusEnum"); const CustomerExternal_1 = require("./CustomerExternal"); const CompleteAddress_1 = require("./CompleteAddress"); const SubscriptionExternal_1 = require("./SubscriptionExternal"); const InvoiceDiscountAmountsExternal_1 = require("./InvoiceDiscountAmountsExternal"); const ObjectName_1 = require("./ObjectName"); const InvoiceComment_1 = require("./InvoiceComment"); const CollectionMethodEnum_1 = require("./CollectionMethodEnum"); const InvoiceItemExternal_1 = require("./InvoiceItemExternal"); const BillingReasonEnum_1 = require("./BillingReasonEnum"); const DiscountExternal_1 = require("./DiscountExternal"); const MerchantTaxIdSetting_1 = require("./MerchantTaxIdSetting"); const CurrencyEnum_1 = require("./CurrencyEnum"); /** * Check if a given object implements the InvoiceExternal interface. */ function instanceOfInvoiceExternal(value) { if (!('accountId' in value) || value['accountId'] === undefined) return false; if (!('appliedBalanceAmountAtom' in value) || value['appliedBalanceAmountAtom'] === undefined) return false; if (!('billingReason' in value) || value['billingReason'] === undefined) return false; if (!('branding' in value) || value['branding'] === undefined) return false; if (!('collectionMethod' in value) || value['collectionMethod'] === undefined) return false; if (!('createdAt' in value) || value['createdAt'] === undefined) return false; if (!('currency' in value) || value['currency'] === undefined) return false; if (!('customerId' in value) || value['customerId'] === undefined) return false; if (!('dueAmountAtom' in value) || value['dueAmountAtom'] === undefined) return false; if (!('dueDate' in value) || value['dueDate'] === undefined) return false; if (!('id' in value) || value['id'] === undefined) return false; if (!('invoiceNumber' in value) || value['invoiceNumber'] === undefined) return false; if (!('invoicePdfUrl' in value) || value['invoicePdfUrl'] === undefined) return false; if (!('isInitialInvoiceForTrialSub' in value) || value['isInitialInvoiceForTrialSub'] === undefined) return false; if (!('lines' in value) || value['lines'] === undefined) return false; if (!('paidAmountAtom' in value) || value['paidAmountAtom'] === undefined) return false; if (!('paidOutOfBand' in value) || value['paidOutOfBand'] === undefined) return false; if (!('periodEnd' in value) || value['periodEnd'] === undefined) return false; if (!('periodStart' in value) || value['periodStart'] === undefined) return false; if (!('providerTypeFeeAmountAtom' in value) || value['providerTypeFeeAmountAtom'] === undefined) return false; if (!('receiptPdfUrl' in value) || value['receiptPdfUrl'] === undefined) return false; if (!('refundIds' in value) || value['refundIds'] === undefined) return false; if (!('refundedAmountAtom' in value) || value['refundedAmountAtom'] === undefined) return false; if (!('remainingAmountAtom' in value) || value['remainingAmountAtom'] === undefined) return false; if (!('status' in value) || value['status'] === undefined) return false; if (!('taxAmountAtom' in value) || value['taxAmountAtom'] === undefined) return false; if (!('totalAmountAtom' in value) || value['totalAmountAtom'] === undefined) return false; if (!('totalExcludingTaxesAmountAtom' in value) || value['totalExcludingTaxesAmountAtom'] === undefined) return false; if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false; return true; } function InvoiceExternalFromJSON(json) { return InvoiceExternalFromJSONTyped(json, false); } function InvoiceExternalFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'accountId': json['account_id'], 'appliedBalanceAmountAtom': json['applied_balance_amount_atom'], 'billedTo': json['billed_to'] == null ? undefined : json['billed_to'], 'billedToBusinessName': json['billed_to_business_name'] == null ? undefined : json['billed_to_business_name'], 'billingReason': (0, BillingReasonEnum_1.BillingReasonEnumFromJSON)(json['billing_reason']), 'branding': json['branding'], 'collectionMethod': (0, CollectionMethodEnum_1.CollectionMethodEnumFromJSON)(json['collection_method']), 'comments': json['comments'] == null ? undefined : (json['comments'].map(InvoiceComment_1.InvoiceCommentFromJSON)), 'createdAt': (new Date(json['created_at'])), 'creditNoteIds': json['credit_note_ids'] == null ? undefined : json['credit_note_ids'], 'currency': (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']), 'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'], 'customer': json['customer'] == null ? undefined : (0, CustomerExternal_1.CustomerExternalFromJSON)(json['customer']), 'customerBillingAddress': json['customer_billing_address'] == null ? undefined : (0, CompleteAddress_1.CompleteAddressFromJSON)(json['customer_billing_address']), 'customerId': json['customer_id'], 'customerTaxIds': json['customer_tax_ids'] == null ? undefined : (json['customer_tax_ids'].map(TaxIdSetting_1.TaxIdSettingFromJSON)), 'defaultPaymentMethodId': json['default_payment_method_id'] == null ? undefined : json['default_payment_method_id'], 'description': json['description'] == null ? undefined : json['description'], 'discounts': json['discounts'] == null ? undefined : (json['discounts'].map(DiscountExternal_1.DiscountExternalFromJSON)), 'dueAmountAtom': json['due_amount_atom'], 'dueDate': (new Date(json['due_date'])), 'emailInvoiceOnFinalization': json['email_invoice_on_finalization'] == null ? undefined : json['email_invoice_on_finalization'], 'hostedInvoiceUrl': json['hosted_invoice_url'] == null ? undefined : json['hosted_invoice_url'], 'id': json['id'], 'invoiceNumber': json['invoice_number'], 'invoicePdfUrl': json['invoice_pdf_url'], 'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'], 'isInitialInvoiceForTrialSub': json['is_initial_invoice_for_trial_sub'], 'latestPaymentAttemptFailureMessage': json['latest_payment_attempt_failure_message'] == null ? undefined : json['latest_payment_attempt_failure_message'], 'latestPaymentIntentId': json['latest_payment_intent_id'] == null ? undefined : json['latest_payment_intent_id'], 'lines': (json['lines'].map(InvoiceItemExternal_1.InvoiceItemExternalFromJSON)), 'merchantBillingAddress': json['merchant_billing_address'] == null ? undefined : (0, CompleteAddress_1.CompleteAddressFromJSON)(json['merchant_billing_address']), 'merchantTaxIds': json['merchant_tax_ids'] == null ? undefined : (json['merchant_tax_ids'].map(MerchantTaxIdSetting_1.MerchantTaxIdSettingFromJSON)), 'metadata': json['metadata'] == null ? undefined : json['metadata'], 'netD': json['net_d'] == null ? undefined : json['net_d'], 'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']), 'paidAmountAtom': json['paid_amount_atom'], 'paidAt': json['paid_at'] == null ? undefined : (new Date(json['paid_at'])), 'paidOutOfBand': json['paid_out_of_band'], 'periodEnd': (new Date(json['period_end'])), 'periodStart': (new Date(json['period_start'])), 'postPaymentCreditNotesAmount': json['post_payment_credit_notes_amount'] == null ? undefined : json['post_payment_credit_notes_amount'], 'prePaymentCreditNotesAmount': json['pre_payment_credit_notes_amount'] == null ? undefined : json['pre_payment_credit_notes_amount'], 'providerTypeFeeAmountAtom': json['provider_type_fee_amount_atom'], 'receiptPdfUrl': json['receipt_pdf_url'], 'refundIds': json['refund_ids'], 'refundedAmountAtom': json['refunded_amount_atom'], 'remainingAmountAtom': json['remaining_amount_atom'], 'status': (0, InvoiceStatusEnum_1.InvoiceStatusEnumFromJSON)(json['status']), 'subscription': json['subscription'] == null ? undefined : (0, SubscriptionExternal_1.SubscriptionExternalFromJSON)(json['subscription']), 'subscriptionId': json['subscription_id'] == null ? undefined : json['subscription_id'], 'taxAmountAtom': json['tax_amount_atom'], 'taxProcessorUpdatedAt': json['tax_processor_updated_at'] == null ? undefined : (new Date(json['tax_processor_updated_at'])), 'totalAmountAtom': json['total_amount_atom'], 'totalDiscountAmountAtoms': json['total_discount_amount_atoms'] == null ? undefined : (json['total_discount_amount_atoms'].map(InvoiceDiscountAmountsExternal_1.InvoiceDiscountAmountsExternalFromJSON)), 'totalExcludingTaxesAmountAtom': json['total_excluding_taxes_amount_atom'], 'updatedAt': (new Date(json['updated_at'])), }; } function InvoiceExternalToJSON(json) { return InvoiceExternalToJSONTyped(json, false); } function InvoiceExternalToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'account_id': value['accountId'], 'applied_balance_amount_atom': value['appliedBalanceAmountAtom'], 'billed_to': value['billedTo'], 'billed_to_business_name': value['billedToBusinessName'], 'billing_reason': (0, BillingReasonEnum_1.BillingReasonEnumToJSON)(value['billingReason']), 'branding': value['branding'], 'collection_method': (0, CollectionMethodEnum_1.CollectionMethodEnumToJSON)(value['collectionMethod']), 'comments': value['comments'] == null ? undefined : (value['comments'].map(InvoiceComment_1.InvoiceCommentToJSON)), 'created_at': ((value['createdAt']).toISOString()), 'credit_note_ids': value['creditNoteIds'], 'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']), 'custom_fields': value['customFields'], 'customer': (0, CustomerExternal_1.CustomerExternalToJSON)(value['customer']), 'customer_billing_address': (0, CompleteAddress_1.CompleteAddressToJSON)(value['customerBillingAddress']), 'customer_id': value['customerId'], 'customer_tax_ids': value['customerTaxIds'] == null ? undefined : (value['customerTaxIds'].map(TaxIdSetting_1.TaxIdSettingToJSON)), 'default_payment_method_id': value['defaultPaymentMethodId'], 'description': value['description'], 'discounts': value['discounts'] == null ? undefined : (value['discounts'].map(DiscountExternal_1.DiscountExternalToJSON)), 'due_amount_atom': value['dueAmountAtom'], 'due_date': ((value['dueDate']).toISOString()), 'email_invoice_on_finalization': value['emailInvoiceOnFinalization'], 'hosted_invoice_url': value['hostedInvoiceUrl'], 'id': value['id'], 'invoice_number': value['invoiceNumber'], 'invoice_pdf_url': value['invoicePdfUrl'], 'is_deleted': value['isDeleted'], 'is_initial_invoice_for_trial_sub': value['isInitialInvoiceForTrialSub'], 'latest_payment_attempt_failure_message': value['latestPaymentAttemptFailureMessage'], 'latest_payment_intent_id': value['latestPaymentIntentId'], 'lines': (value['lines'].map(InvoiceItemExternal_1.InvoiceItemExternalToJSON)), 'merchant_billing_address': (0, CompleteAddress_1.CompleteAddressToJSON)(value['merchantBillingAddress']), 'merchant_tax_ids': value['merchantTaxIds'] == null ? undefined : (value['merchantTaxIds'].map(MerchantTaxIdSetting_1.MerchantTaxIdSettingToJSON)), 'metadata': value['metadata'], 'net_d': value['netD'], 'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']), 'paid_amount_atom': value['paidAmountAtom'], 'paid_at': value['paidAt'] == null ? undefined : (value['paidAt'].toISOString()), 'paid_out_of_band': value['paidOutOfBand'], 'period_end': ((value['periodEnd']).toISOString()), 'period_start': ((value['periodStart']).toISOString()), 'post_payment_credit_notes_amount': value['postPaymentCreditNotesAmount'], 'pre_payment_credit_notes_amount': value['prePaymentCreditNotesAmount'], 'provider_type_fee_amount_atom': value['providerTypeFeeAmountAtom'], 'receipt_pdf_url': value['receiptPdfUrl'], 'refund_ids': value['refundIds'], 'refunded_amount_atom': value['refundedAmountAtom'], 'remaining_amount_atom': value['remainingAmountAtom'], 'status': (0, InvoiceStatusEnum_1.InvoiceStatusEnumToJSON)(value['status']), 'subscription': (0, SubscriptionExternal_1.SubscriptionExternalToJSON)(value['subscription']), 'subscription_id': value['subscriptionId'], 'tax_amount_atom': value['taxAmountAtom'], 'tax_processor_updated_at': value['taxProcessorUpdatedAt'] == null ? undefined : (value['taxProcessorUpdatedAt'].toISOString()), 'total_amount_atom': value['totalAmountAtom'], 'total_discount_amount_atoms': value['totalDiscountAmountAtoms'] == null ? undefined : (value['totalDiscountAmountAtoms'].map(InvoiceDiscountAmountsExternal_1.InvoiceDiscountAmountsExternalToJSON)), 'total_excluding_taxes_amount_atom': value['totalExcludingTaxesAmountAtom'], 'updated_at': ((value['updatedAt']).toISOString()), }; }