UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

82 lines (81 loc) 4.19 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.instanceOfCreatePaymentLinkRequest = instanceOfCreatePaymentLinkRequest; exports.CreatePaymentLinkRequestFromJSON = CreatePaymentLinkRequestFromJSON; exports.CreatePaymentLinkRequestFromJSONTyped = CreatePaymentLinkRequestFromJSONTyped; exports.CreatePaymentLinkRequestToJSON = CreatePaymentLinkRequestToJSON; exports.CreatePaymentLinkRequestToJSONTyped = CreatePaymentLinkRequestToJSONTyped; const CreateCheckoutLineItem_1 = require("./CreateCheckoutLineItem"); const CheckoutPreferences_1 = require("./CheckoutPreferences"); const CheckoutMode_1 = require("./CheckoutMode"); /** * Check if a given object implements the CreatePaymentLinkRequest interface. */ function instanceOfCreatePaymentLinkRequest(value) { if (!('mode' in value) || value['mode'] === undefined) return false; if (!('successUrl' in value) || value['successUrl'] === undefined) return false; return true; } function CreatePaymentLinkRequestFromJSON(json) { return CreatePaymentLinkRequestFromJSONTyped(json, false); } function CreatePaymentLinkRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'allowRemoveLineItems': json['allow_remove_line_items'] == null ? undefined : json['allow_remove_line_items'], 'alwaysCreateNewCustomer': json['always_create_new_customer'] == null ? undefined : json['always_create_new_customer'], 'checkoutPreferences': json['checkout_preferences'] == null ? undefined : (0, CheckoutPreferences_1.CheckoutPreferencesFromJSON)(json['checkout_preferences']), 'couponId': json['coupon_id'] == null ? undefined : json['coupon_id'], 'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'], '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']), 'pinned': json['pinned'] == null ? undefined : json['pinned'], 'productBundleIds': json['product_bundle_ids'] == null ? undefined : json['product_bundle_ids'], 'successUrl': 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 CreatePaymentLinkRequestToJSON(json) { return CreatePaymentLinkRequestToJSONTyped(json, false); } function CreatePaymentLinkRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'allow_remove_line_items': value['allowRemoveLineItems'], 'always_create_new_customer': value['alwaysCreateNewCustomer'], 'checkout_preferences': (0, CheckoutPreferences_1.CheckoutPreferencesToJSON)(value['checkoutPreferences']), 'coupon_id': value['couponId'], 'custom_fields': value['customFields'], 'customer_id': value['customerId'], 'line_items': value['lineItems'] == null ? undefined : (value['lineItems'].map(CreateCheckoutLineItem_1.CreateCheckoutLineItemToJSON)), 'mode': (0, CheckoutMode_1.CheckoutModeToJSON)(value['mode']), 'pinned': value['pinned'], 'product_bundle_ids': value['productBundleIds'], 'success_url': value['successUrl'], 'trial_end': value['trialEnd'] == null ? undefined : (value['trialEnd'].toISOString()), 'trial_from_price': value['trialFromPrice'], 'trial_period_days': value['trialPeriodDays'], }; }