UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

147 lines (146 loc) 8.22 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.instanceOfInvoicePublic = instanceOfInvoicePublic; exports.InvoicePublicFromJSON = InvoicePublicFromJSON; exports.InvoicePublicFromJSONTyped = InvoicePublicFromJSONTyped; exports.InvoicePublicToJSON = InvoicePublicToJSON; exports.InvoicePublicToJSONTyped = InvoicePublicToJSONTyped; const InvoiceItemPublic_1 = require("./InvoiceItemPublic"); const TaxIdSetting_1 = require("./TaxIdSetting"); const InvoiceStatusEnum_1 = require("./InvoiceStatusEnum"); const MerchantTaxIdSetting_1 = require("./MerchantTaxIdSetting"); const CurrencyEnum_1 = require("./CurrencyEnum"); const InvoiceDiscountAmountsExternal_1 = require("./InvoiceDiscountAmountsExternal"); /** * Check if a given object implements the InvoicePublic interface. */ function instanceOfInvoicePublic(value) { if (!('appliedBalanceAmountAtom' in value) || value['appliedBalanceAmountAtom'] === undefined) return false; if (!('branding' in value) || value['branding'] === undefined) return false; if (!('createdAt' in value) || value['createdAt'] === undefined) return false; if (!('currency' in value) || value['currency'] === undefined) return false; if (!('dueAmountAtom' in value) || value['dueAmountAtom'] === undefined) return false; if (!('id' in value) || value['id'] === undefined) return false; if (!('invoicePdfUrl' in value) || value['invoicePdfUrl'] === undefined) return false; if (!('isInitialInvoiceForTrialSub' in value) || value['isInitialInvoiceForTrialSub'] === undefined) return false; if (!('paidAmountAtom' in value) || value['paidAmountAtom'] === undefined) return false; if (!('providerTypeFeeAmountAtom' in value) || value['providerTypeFeeAmountAtom'] === undefined) return false; if (!('receiptPdfUrl' in value) || value['receiptPdfUrl'] === 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 (!('trialEndForSub' in value) || value['trialEndForSub'] === undefined) return false; if (!('trialStartForSub' in value) || value['trialStartForSub'] === undefined) return false; return true; } function InvoicePublicFromJSON(json) { return InvoicePublicFromJSONTyped(json, false); } function InvoicePublicFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { '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'], 'billingAddress': json['billing_address'] == null ? undefined : json['billing_address'], 'branding': json['branding'], 'cardType': json['card_type'] == null ? undefined : json['card_type'], 'createdAt': (new Date(json['created_at'])), 'currency': (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']), 'customerTaxIds': json['customer_tax_ids'] == null ? undefined : (json['customer_tax_ids'].map(TaxIdSetting_1.TaxIdSettingFromJSON)), 'dueAmountAtom': json['due_amount_atom'], 'dueDate': json['due_date'] == null ? undefined : (new Date(json['due_date'])), 'id': json['id'], 'invoicePdfUrl': json['invoice_pdf_url'], 'isInitialInvoiceForTrialSub': json['is_initial_invoice_for_trial_sub'], 'lastFour': json['last_four'] == null ? undefined : json['last_four'], 'lines': json['lines'] == null ? undefined : (json['lines'].map(InvoiceItemPublic_1.InvoiceItemPublicFromJSON)), 'merchantTaxIds': json['merchant_tax_ids'] == null ? undefined : (json['merchant_tax_ids'].map(MerchantTaxIdSetting_1.MerchantTaxIdSettingFromJSON)), 'paidAmountAtom': json['paid_amount_atom'], 'paidAt': json['paid_at'] == null ? undefined : (new Date(json['paid_at'])), 'providerTypeFeeAmountAtom': json['provider_type_fee_amount_atom'], 'receiptPdfUrl': json['receipt_pdf_url'], 'remainingAmountAtom': json['remaining_amount_atom'], 'status': (0, InvoiceStatusEnum_1.InvoiceStatusEnumFromJSON)(json['status']), 'taxAmountAtom': json['tax_amount_atom'], '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'], 'trialEndForSub': (json['trial_end_for_sub'] == null ? null : new Date(json['trial_end_for_sub'])), 'trialStartForSub': (json['trial_start_for_sub'] == null ? null : new Date(json['trial_start_for_sub'])), }; } function InvoicePublicToJSON(json) { return InvoicePublicToJSONTyped(json, false); } function InvoicePublicToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'applied_balance_amount_atom': value['appliedBalanceAmountAtom'], 'billed_to': value['billedTo'], 'billed_to_business_name': value['billedToBusinessName'], 'billing_address': value['billingAddress'], 'branding': value['branding'], 'card_type': value['cardType'], 'created_at': ((value['createdAt']).toISOString()), 'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']), 'customer_tax_ids': value['customerTaxIds'] == null ? undefined : (value['customerTaxIds'].map(TaxIdSetting_1.TaxIdSettingToJSON)), 'due_amount_atom': value['dueAmountAtom'], 'due_date': value['dueDate'] == null ? undefined : (value['dueDate'].toISOString()), 'id': value['id'], 'invoice_pdf_url': value['invoicePdfUrl'], 'is_initial_invoice_for_trial_sub': value['isInitialInvoiceForTrialSub'], 'last_four': value['lastFour'], 'lines': value['lines'] == null ? undefined : (value['lines'].map(InvoiceItemPublic_1.InvoiceItemPublicToJSON)), 'merchant_tax_ids': value['merchantTaxIds'] == null ? undefined : (value['merchantTaxIds'].map(MerchantTaxIdSetting_1.MerchantTaxIdSettingToJSON)), 'paid_amount_atom': value['paidAmountAtom'], 'paid_at': value['paidAt'] == null ? undefined : (value['paidAt'].toISOString()), 'provider_type_fee_amount_atom': value['providerTypeFeeAmountAtom'], 'receipt_pdf_url': value['receiptPdfUrl'], 'remaining_amount_atom': value['remainingAmountAtom'], 'status': (0, InvoiceStatusEnum_1.InvoiceStatusEnumToJSON)(value['status']), 'tax_amount_atom': value['taxAmountAtom'], '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'], 'trial_end_for_sub': (value['trialEndForSub'] == null ? null : value['trialEndForSub'].toISOString()), 'trial_start_for_sub': (value['trialStartForSub'] == null ? null : value['trialStartForSub'].toISOString()), }; }