@getopenpay/client
Version:
OpenPay API TypeScript SDK
142 lines (141 loc) • 8.65 kB
JavaScript
;
/* 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.instanceOfCustomerExternal = instanceOfCustomerExternal;
exports.CustomerExternalFromJSON = CustomerExternalFromJSON;
exports.CustomerExternalFromJSONTyped = CustomerExternalFromJSONTyped;
exports.CustomerExternalToJSON = CustomerExternalToJSON;
exports.CustomerExternalToJSONTyped = CustomerExternalToJSONTyped;
const ProductExternal_1 = require("./ProductExternal");
const CustomerInvoiceSettings_1 = require("./CustomerInvoiceSettings");
const CustomerBalanceExternal_1 = require("./CustomerBalanceExternal");
const PaymentIntentExternal_1 = require("./PaymentIntentExternal");
const CustomerStatus_1 = require("./CustomerStatus");
const DiscountExternal_1 = require("./DiscountExternal");
const CompleteAddress_1 = require("./CompleteAddress");
const CustomerLanguage_1 = require("./CustomerLanguage");
const SubscriptionExternal_1 = require("./SubscriptionExternal");
const CustomerTotalAmount_1 = require("./CustomerTotalAmount");
const ObjectName_1 = require("./ObjectName");
/**
* Check if a given object implements the CustomerExternal interface.
*/
function instanceOfCustomerExternal(value) {
if (!('accountId' in value) || value['accountId'] === undefined)
return false;
if (!('address' in value) || value['address'] === undefined)
return false;
if (!('businessName' in value) || value['businessName'] === undefined)
return false;
if (!('createdAt' in value) || value['createdAt'] === undefined)
return false;
if (!('email' in value) || value['email'] === undefined)
return false;
if (!('firstName' in value) || value['firstName'] === undefined)
return false;
if (!('id' in value) || value['id'] === undefined)
return false;
if (!('lastName' in value) || value['lastName'] === undefined)
return false;
if (!('notes' in value) || value['notes'] === undefined)
return false;
if (!('shouldSendPaymentReceipt' in value) || value['shouldSendPaymentReceipt'] === undefined)
return false;
if (!('updatedAt' in value) || value['updatedAt'] === undefined)
return false;
return true;
}
function CustomerExternalFromJSON(json) {
return CustomerExternalFromJSONTyped(json, false);
}
function CustomerExternalFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'accountId': json['account_id'],
'address': (0, CompleteAddress_1.CompleteAddressFromJSON)(json['address']),
'balanceAtoms': json['balance_atoms'] == null ? undefined : (json['balance_atoms'].map(CustomerBalanceExternal_1.CustomerBalanceExternalFromJSON)),
'billingEmail': json['billing_email'] == null ? undefined : json['billing_email'],
'businessName': json['business_name'],
'createdAt': (new Date(json['created_at'])),
'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'],
'customerBillingAddress': json['customer_billing_address'] == null ? undefined : (0, CompleteAddress_1.CompleteAddressFromJSON)(json['customer_billing_address']),
'discount': json['discount'] == null ? undefined : (0, DiscountExternal_1.DiscountExternalFromJSON)(json['discount']),
'email': json['email'],
'firstCardIp': json['first_card_ip'] == null ? undefined : json['first_card_ip'],
'firstName': json['first_name'],
'id': json['id'],
'invoiceSettings': json['invoice_settings'] == null ? undefined : (0, CustomerInvoiceSettings_1.CustomerInvoiceSettingsFromJSON)(json['invoice_settings']),
'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'],
'language': json['language'] == null ? undefined : (0, CustomerLanguage_1.CustomerLanguageFromJSON)(json['language']),
'lastName': json['last_name'],
'lastSuccessfulPaymentIntent': json['last_successful_payment_intent'] == null ? undefined : (0, PaymentIntentExternal_1.PaymentIntentExternalFromJSON)(json['last_successful_payment_intent']),
'metadata': json['metadata'] == null ? undefined : json['metadata'],
'mrr': json['mrr'] == null ? undefined : (json['mrr'].map(CustomerTotalAmount_1.CustomerTotalAmountFromJSON)),
'notes': json['notes'],
'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']),
'phoneNumber': json['phone_number'] == null ? undefined : json['phone_number'],
'shippingAddresses': json['shipping_addresses'] == null ? undefined : (json['shipping_addresses'].map(CompleteAddress_1.CompleteAddressFromJSON)),
'shouldSendPaymentReceipt': json['should_send_payment_receipt'],
'status': json['status'] == null ? undefined : (0, CustomerStatus_1.CustomerStatusFromJSON)(json['status']),
'subscribedToProducts': json['subscribed_to_products'] == null ? undefined : (json['subscribed_to_products'].map(ProductExternal_1.ProductExternalFromJSON)),
'subscriptions': json['subscriptions'] == null ? undefined : (json['subscriptions'].map(SubscriptionExternal_1.SubscriptionExternalFromJSON)),
'totalRefunds': json['total_refunds'] == null ? undefined : (json['total_refunds'].map(CustomerTotalAmount_1.CustomerTotalAmountFromJSON)),
'totalSpent': json['total_spent'] == null ? undefined : (json['total_spent'].map(CustomerTotalAmount_1.CustomerTotalAmountFromJSON)),
'updatedAt': (new Date(json['updated_at'])),
};
}
function CustomerExternalToJSON(json) {
return CustomerExternalToJSONTyped(json, false);
}
function CustomerExternalToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'account_id': value['accountId'],
'address': (0, CompleteAddress_1.CompleteAddressToJSON)(value['address']),
'balance_atoms': value['balanceAtoms'] == null ? undefined : (value['balanceAtoms'].map(CustomerBalanceExternal_1.CustomerBalanceExternalToJSON)),
'billing_email': value['billingEmail'],
'business_name': value['businessName'],
'created_at': ((value['createdAt']).toISOString()),
'custom_fields': value['customFields'],
'customer_billing_address': (0, CompleteAddress_1.CompleteAddressToJSON)(value['customerBillingAddress']),
'discount': (0, DiscountExternal_1.DiscountExternalToJSON)(value['discount']),
'email': value['email'],
'first_card_ip': value['firstCardIp'],
'first_name': value['firstName'],
'id': value['id'],
'invoice_settings': (0, CustomerInvoiceSettings_1.CustomerInvoiceSettingsToJSON)(value['invoiceSettings']),
'is_deleted': value['isDeleted'],
'language': (0, CustomerLanguage_1.CustomerLanguageToJSON)(value['language']),
'last_name': value['lastName'],
'last_successful_payment_intent': (0, PaymentIntentExternal_1.PaymentIntentExternalToJSON)(value['lastSuccessfulPaymentIntent']),
'metadata': value['metadata'],
'mrr': value['mrr'] == null ? undefined : (value['mrr'].map(CustomerTotalAmount_1.CustomerTotalAmountToJSON)),
'notes': value['notes'],
'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']),
'phone_number': value['phoneNumber'],
'shipping_addresses': value['shippingAddresses'] == null ? undefined : (value['shippingAddresses'].map(CompleteAddress_1.CompleteAddressToJSON)),
'should_send_payment_receipt': value['shouldSendPaymentReceipt'],
'status': (0, CustomerStatus_1.CustomerStatusToJSON)(value['status']),
'subscribed_to_products': value['subscribedToProducts'] == null ? undefined : (value['subscribedToProducts'].map(ProductExternal_1.ProductExternalToJSON)),
'subscriptions': value['subscriptions'] == null ? undefined : (value['subscriptions'].map(SubscriptionExternal_1.SubscriptionExternalToJSON)),
'total_refunds': value['totalRefunds'] == null ? undefined : (value['totalRefunds'].map(CustomerTotalAmount_1.CustomerTotalAmountToJSON)),
'total_spent': value['totalSpent'] == null ? undefined : (value['totalSpent'].map(CustomerTotalAmount_1.CustomerTotalAmountToJSON)),
'updated_at': ((value['updatedAt']).toISOString()),
};
}