UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

172 lines (171 loc) 9.43 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.instanceOfCheckoutSessionExternal = instanceOfCheckoutSessionExternal; exports.CheckoutSessionExternalFromJSON = CheckoutSessionExternalFromJSON; exports.CheckoutSessionExternalFromJSONTyped = CheckoutSessionExternalFromJSONTyped; exports.CheckoutSessionExternalToJSON = CheckoutSessionExternalToJSON; exports.CheckoutSessionExternalToJSONTyped = CheckoutSessionExternalToJSONTyped; const ProductBundleExternal_1 = require("./ProductBundleExternal"); const SetupIntentExternal_1 = require("./SetupIntentExternal"); const CheckoutSessionLineItemExternal_1 = require("./CheckoutSessionLineItemExternal"); const CheckoutSessionStatus_1 = require("./CheckoutSessionStatus"); const CustomerLanguage_1 = require("./CustomerLanguage"); const CheckoutMode_1 = require("./CheckoutMode"); const ObjectName_1 = require("./ObjectName"); /** * Check if a given object implements the CheckoutSessionExternal interface. */ function instanceOfCheckoutSessionExternal(value) { if (!('accountId' in value) || value['accountId'] === undefined) return false; if (!('accountName' in value) || value['accountName'] === undefined) return false; if (!('amountSubtotalAtom' in value) || value['amountSubtotalAtom'] === undefined) return false; if (!('amountTotalAtom' in value) || value['amountTotalAtom'] === undefined) return false; if (!('createdAt' in value) || value['createdAt'] === undefined) return false; if (!('currency' in value) || value['currency'] === undefined) return false; if (!('customerEmail' in value) || value['customerEmail'] === undefined) return false; if (!('customerId' in value) || value['customerId'] === undefined) return false; if (!('id' in value) || value['id'] === undefined) return false; if (!('lineItems' in value) || value['lineItems'] === undefined) return false; if (!('mode' in value) || value['mode'] === undefined) return false; if (!('returnUrl' in value) || value['returnUrl'] === undefined) return false; if (!('secureToken' in value) || value['secureToken'] === undefined) return false; if (!('setupIntent' in value) || value['setupIntent'] === undefined) return false; if (!('status' in value) || value['status'] === undefined) return false; if (!('subscriptionIds' in value) || value['subscriptionIds'] === undefined) return false; if (!('successUrl' in value) || value['successUrl'] === undefined) return false; if (!('taxAmountAtom' in value) || value['taxAmountAtom'] === undefined) return false; if (!('trialEnd' in value) || value['trialEnd'] === undefined) return false; if (!('trialFromPrice' in value) || value['trialFromPrice'] === undefined) return false; if (!('trialPeriodDays' in value) || value['trialPeriodDays'] === undefined) return false; if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false; if (!('url' in value) || value['url'] === undefined) return false; return true; } function CheckoutSessionExternalFromJSON(json) { return CheckoutSessionExternalFromJSONTyped(json, false); } function CheckoutSessionExternalFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'accountId': json['account_id'], 'accountName': json['account_name'], 'amountSubtotalAtom': json['amount_subtotal_atom'], 'amountTotalAtom': json['amount_total_atom'], 'checkoutPreferences': json['checkout_preferences'] == null ? undefined : json['checkout_preferences'], 'clientReferenceId': json['client_reference_id'] == null ? undefined : json['client_reference_id'], 'couponId': json['coupon_id'] == null ? undefined : json['coupon_id'], 'createdAt': (new Date(json['created_at'])), 'currency': json['currency'], 'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'], 'customerEmail': json['customer_email'], 'customerId': json['customer_id'], 'id': json['id'], 'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'], 'language': json['language'] == null ? undefined : (0, CustomerLanguage_1.CustomerLanguageFromJSON)(json['language']), 'lineItems': (json['line_items'].map(CheckoutSessionLineItemExternal_1.CheckoutSessionLineItemExternalFromJSON)), 'manuallyExpiredAt': json['manually_expired_at'] == null ? undefined : (new Date(json['manually_expired_at'])), 'mode': (0, CheckoutMode_1.CheckoutModeFromJSON)(json['mode']), 'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']), 'productBundles': json['product_bundles'] == null ? undefined : (json['product_bundles'].map(ProductBundleExternal_1.ProductBundleExternalFromJSON)), 'returnUrl': json['return_url'], 'secureToken': json['secure_token'], 'selectedLineItems': json['selected_line_items'] == null ? undefined : (json['selected_line_items'].map(CheckoutSessionLineItemExternal_1.CheckoutSessionLineItemExternalFromJSON)), 'selectedProductBundle': json['selected_product_bundle'] == null ? undefined : (0, ProductBundleExternal_1.ProductBundleExternalFromJSON)(json['selected_product_bundle']), 'setupIntent': (0, SetupIntentExternal_1.SetupIntentExternalFromJSON)(json['setup_intent']), 'status': (0, CheckoutSessionStatus_1.CheckoutSessionStatusFromJSON)(json['status']), 'subscriptionId': json['subscription_id'] == null ? undefined : json['subscription_id'], 'subscriptionIds': json['subscription_ids'] == null ? null : json['subscription_ids'], 'successUrl': json['success_url'], 'successfulAttemptId': json['successful_attempt_id'] == null ? undefined : json['successful_attempt_id'], 'taxAmountAtom': json['tax_amount_atom'], 'trialEnd': (json['trial_end'] == null ? null : new Date(json['trial_end'])), 'trialFromPrice': json['trial_from_price'], 'trialPeriodDays': json['trial_period_days'], 'updatedAt': (new Date(json['updated_at'])), 'url': json['url'], }; } function CheckoutSessionExternalToJSON(json) { return CheckoutSessionExternalToJSONTyped(json, false); } function CheckoutSessionExternalToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'account_id': value['accountId'], 'account_name': value['accountName'], 'amount_subtotal_atom': value['amountSubtotalAtom'], 'amount_total_atom': value['amountTotalAtom'], 'checkout_preferences': value['checkoutPreferences'], 'client_reference_id': value['clientReferenceId'], 'coupon_id': value['couponId'], 'created_at': ((value['createdAt']).toISOString()), 'currency': value['currency'], 'custom_fields': value['customFields'], 'customer_email': value['customerEmail'], 'customer_id': value['customerId'], 'id': value['id'], 'is_deleted': value['isDeleted'], 'language': (0, CustomerLanguage_1.CustomerLanguageToJSON)(value['language']), 'line_items': (value['lineItems'].map(CheckoutSessionLineItemExternal_1.CheckoutSessionLineItemExternalToJSON)), 'manually_expired_at': value['manuallyExpiredAt'] == null ? undefined : (value['manuallyExpiredAt'].toISOString()), 'mode': (0, CheckoutMode_1.CheckoutModeToJSON)(value['mode']), 'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']), 'product_bundles': value['productBundles'] == null ? undefined : (value['productBundles'].map(ProductBundleExternal_1.ProductBundleExternalToJSON)), 'return_url': value['returnUrl'], 'secure_token': value['secureToken'], 'selected_line_items': value['selectedLineItems'] == null ? undefined : (value['selectedLineItems'].map(CheckoutSessionLineItemExternal_1.CheckoutSessionLineItemExternalToJSON)), 'selected_product_bundle': (0, ProductBundleExternal_1.ProductBundleExternalToJSON)(value['selectedProductBundle']), 'setup_intent': (0, SetupIntentExternal_1.SetupIntentExternalToJSON)(value['setupIntent']), 'status': (0, CheckoutSessionStatus_1.CheckoutSessionStatusToJSON)(value['status']), 'subscription_id': value['subscriptionId'], 'subscription_ids': value['subscriptionIds'], 'success_url': value['successUrl'], 'successful_attempt_id': value['successfulAttemptId'], 'tax_amount_atom': value['taxAmountAtom'], 'trial_end': (value['trialEnd'] == null ? null : value['trialEnd'].toISOString()), 'trial_from_price': value['trialFromPrice'], 'trial_period_days': value['trialPeriodDays'], 'updated_at': ((value['updatedAt']).toISOString()), 'url': value['url'], }; }