UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

81 lines (80 loc) 4.25 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.instanceOfCreateCheckoutSessionRequest = instanceOfCreateCheckoutSessionRequest; exports.CreateCheckoutSessionRequestFromJSON = CreateCheckoutSessionRequestFromJSON; exports.CreateCheckoutSessionRequestFromJSONTyped = CreateCheckoutSessionRequestFromJSONTyped; exports.CreateCheckoutSessionRequestToJSON = CreateCheckoutSessionRequestToJSON; exports.CreateCheckoutSessionRequestToJSONTyped = CreateCheckoutSessionRequestToJSONTyped; const CreateCheckoutLineItem_1 = require("./CreateCheckoutLineItem"); const CheckoutPreferences_1 = require("./CheckoutPreferences"); const CurrencyEnum_1 = require("./CurrencyEnum"); const CheckoutMode_1 = require("./CheckoutMode"); /** * Check if a given object implements the CreateCheckoutSessionRequest interface. */ function instanceOfCreateCheckoutSessionRequest(value) { if (!('mode' in value) || value['mode'] === undefined) return false; return true; } function CreateCheckoutSessionRequestFromJSON(json) { return CreateCheckoutSessionRequestFromJSONTyped(json, false); } function CreateCheckoutSessionRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'checkoutPreferences': json['checkout_preferences'] == null ? undefined : (0, CheckoutPreferences_1.CheckoutPreferencesFromJSON)(json['checkout_preferences']), 'clientReferenceId': json['client_reference_id'] == null ? undefined : json['client_reference_id'], 'couponId': json['coupon_id'] == null ? undefined : json['coupon_id'], 'currency': json['currency'] == null ? undefined : (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']), 'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'], 'customerEmail': json['customer_email'] == null ? undefined : json['customer_email'], 'customerId': json['customer_id'] == null ? undefined : json['customer_id'], 'lineItems': json['line_items'] == null ? undefined : (json['line_items'].map(CreateCheckoutLineItem_1.CreateCheckoutLineItemFromJSON)), 'mode': (0, CheckoutMode_1.CheckoutModeFromJSON)(json['mode']), 'returnUrl': json['return_url'] == null ? undefined : json['return_url'], 'successUrl': json['success_url'] == null ? undefined : json['success_url'], 'trialEnd': json['trial_end'] == null ? undefined : (new Date(json['trial_end'])), 'trialFromPrice': json['trial_from_price'] == null ? undefined : json['trial_from_price'], 'trialPeriodDays': json['trial_period_days'] == null ? undefined : json['trial_period_days'], }; } function CreateCheckoutSessionRequestToJSON(json) { return CreateCheckoutSessionRequestToJSONTyped(json, false); } function CreateCheckoutSessionRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'checkout_preferences': (0, CheckoutPreferences_1.CheckoutPreferencesToJSON)(value['checkoutPreferences']), 'client_reference_id': value['clientReferenceId'], 'coupon_id': value['couponId'], 'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']), 'custom_fields': value['customFields'], 'customer_email': value['customerEmail'], 'customer_id': value['customerId'], 'line_items': value['lineItems'] == null ? undefined : (value['lineItems'].map(CreateCheckoutLineItem_1.CreateCheckoutLineItemToJSON)), 'mode': (0, CheckoutMode_1.CheckoutModeToJSON)(value['mode']), 'return_url': value['returnUrl'], 'success_url': value['successUrl'], 'trial_end': value['trialEnd'] == null ? undefined : (value['trialEnd'].toISOString()), 'trial_from_price': value['trialFromPrice'], 'trial_period_days': value['trialPeriodDays'], }; }