UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

177 lines (176 loc) 9.11 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.instanceOfPriceExternal = instanceOfPriceExternal; exports.PriceExternalFromJSON = PriceExternalFromJSON; exports.PriceExternalFromJSONTyped = PriceExternalFromJSONTyped; exports.PriceExternalToJSON = PriceExternalToJSON; exports.PriceExternalToJSONTyped = PriceExternalToJSONTyped; const RecurringDetails_1 = require("./RecurringDetails"); const PriceTypeEnum_1 = require("./PriceTypeEnum"); const ProductExternal_1 = require("./ProductExternal"); const PricingTiersEnum_1 = require("./PricingTiersEnum"); const CalendarIntervalEnum_1 = require("./CalendarIntervalEnum"); const InvoiceSettings_1 = require("./InvoiceSettings"); const PriceTierExternal_1 = require("./PriceTierExternal"); const CurrencyEnum_1 = require("./CurrencyEnum"); const BillingSchemeEnum_1 = require("./BillingSchemeEnum"); const ObjectName_1 = require("./ObjectName"); /** * Check if a given object implements the PriceExternal interface. */ function instanceOfPriceExternal(value) { if (!('billingInterval' in value) || value['billingInterval'] === undefined) return false; if (!('billingIntervalCount' in value) || value['billingIntervalCount'] === undefined) return false; if (!('billingScheme' in value) || value['billingScheme'] === undefined) return false; if (!('canOnlyBePurchasedWith' in value) || value['canOnlyBePurchasedWith'] === undefined) return false; if (!('contractAutoRenew' in value) || value['contractAutoRenew'] === undefined) return false; if (!('contractTermMultiple' in value) || value['contractTermMultiple'] === undefined) return false; if (!('createdAt' in value) || value['createdAt'] === undefined) return false; if (!('currency' in value) || value['currency'] === undefined) return false; if (!('eligibleForUpdates' in value) || value['eligibleForUpdates'] === undefined) return false; if (!('id' in value) || value['id'] === undefined) return false; if (!('internalDescription' in value) || value['internalDescription'] === undefined) return false; if (!('invoiceSettings' in value) || value['invoiceSettings'] === undefined) return false; if (!('isActive' in value) || value['isActive'] === undefined) return false; if (!('isDefault' in value) || value['isDefault'] === undefined) return false; if (!('isLicensed' in value) || value['isLicensed'] === undefined) return false; if (!('listedExclusivelyForCustomers' in value) || value['listedExclusivelyForCustomers'] === undefined) return false; if (!('optionalAddOns' in value) || value['optionalAddOns'] === undefined) return false; if (!('priceTiers' in value) || value['priceTiers'] === undefined) return false; if (!('priceType' in value) || value['priceType'] === undefined) return false; if (!('productId' in value) || value['productId'] === undefined) return false; if (!('productName' in value) || value['productName'] === undefined) return false; if (!('recurringDetails' in value) || value['recurringDetails'] === undefined) return false; if (!('tiersMode' in value) || value['tiersMode'] === undefined) return false; if (!('transformQuantityDivideBy' in value) || value['transformQuantityDivideBy'] === undefined) return false; if (!('unitAmountAtom' in value) || value['unitAmountAtom'] === undefined) return false; if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false; return true; } function PriceExternalFromJSON(json) { return PriceExternalFromJSONTyped(json, false); } function PriceExternalFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'billingInterval': (0, CalendarIntervalEnum_1.CalendarIntervalEnumFromJSON)(json['billing_interval']), 'billingIntervalCount': json['billing_interval_count'], 'billingScheme': (0, BillingSchemeEnum_1.BillingSchemeEnumFromJSON)(json['billing_scheme']), 'canOnlyBePurchasedWith': json['can_only_be_purchased_with'], 'contractAutoRenew': json['contract_auto_renew'], 'contractTermMultiple': json['contract_term_multiple'], 'createdAt': (new Date(json['created_at'])), 'currency': (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']), 'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'], 'eligibleForUpdates': json['eligible_for_updates'], 'id': json['id'], 'internalDescription': json['internal_description'], 'invoiceSettings': (0, InvoiceSettings_1.InvoiceSettingsFromJSON)(json['invoice_settings']), 'isActive': json['is_active'], 'isDefault': json['is_default'], 'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'], 'isExclusive': json['is_exclusive'] == null ? undefined : json['is_exclusive'], 'isLicensed': json['is_licensed'], 'listedExclusivelyForCustomers': json['listed_exclusively_for_customers'], 'metadata': json['metadata'] == null ? undefined : json['metadata'], 'meterId': json['meter_id'] == null ? undefined : json['meter_id'], 'name': json['name'] == null ? undefined : json['name'], 'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']), 'optionalAddOns': json['optional_add_ons'], 'priceTiers': (json['price_tiers'].map(PriceTierExternal_1.PriceTierExternalFromJSON)), 'priceType': (0, PriceTypeEnum_1.PriceTypeEnumFromJSON)(json['price_type']), 'product': json['product'] == null ? undefined : (0, ProductExternal_1.ProductExternalFromJSON)(json['product']), 'productId': json['product_id'], 'productName': json['product_name'], 'recurringDetails': (0, RecurringDetails_1.RecurringDetailsFromJSON)(json['recurring_details']), 'tiersMode': (0, PricingTiersEnum_1.PricingTiersEnumFromJSON)(json['tiers_mode']), 'transformQuantityDivideBy': json['transform_quantity_divide_by'], 'unitAmountAtom': json['unit_amount_atom'], 'updatedAt': (new Date(json['updated_at'])), }; } function PriceExternalToJSON(json) { return PriceExternalToJSONTyped(json, false); } function PriceExternalToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'billing_interval': (0, CalendarIntervalEnum_1.CalendarIntervalEnumToJSON)(value['billingInterval']), 'billing_interval_count': value['billingIntervalCount'], 'billing_scheme': (0, BillingSchemeEnum_1.BillingSchemeEnumToJSON)(value['billingScheme']), 'can_only_be_purchased_with': value['canOnlyBePurchasedWith'], 'contract_auto_renew': value['contractAutoRenew'], 'contract_term_multiple': value['contractTermMultiple'], 'created_at': ((value['createdAt']).toISOString()), 'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']), 'custom_fields': value['customFields'], 'eligible_for_updates': value['eligibleForUpdates'], 'id': value['id'], 'internal_description': value['internalDescription'], 'invoice_settings': (0, InvoiceSettings_1.InvoiceSettingsToJSON)(value['invoiceSettings']), 'is_active': value['isActive'], 'is_default': value['isDefault'], 'is_deleted': value['isDeleted'], 'is_exclusive': value['isExclusive'], 'is_licensed': value['isLicensed'], 'listed_exclusively_for_customers': value['listedExclusivelyForCustomers'], 'metadata': value['metadata'], 'meter_id': value['meterId'], 'name': value['name'], 'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']), 'optional_add_ons': value['optionalAddOns'], 'price_tiers': (value['priceTiers'].map(PriceTierExternal_1.PriceTierExternalToJSON)), 'price_type': (0, PriceTypeEnum_1.PriceTypeEnumToJSON)(value['priceType']), 'product': (0, ProductExternal_1.ProductExternalToJSON)(value['product']), 'product_id': value['productId'], 'product_name': value['productName'], 'recurring_details': (0, RecurringDetails_1.RecurringDetailsToJSON)(value['recurringDetails']), 'tiers_mode': (0, PricingTiersEnum_1.PricingTiersEnumToJSON)(value['tiersMode']), 'transform_quantity_divide_by': value['transformQuantityDivideBy'], 'unit_amount_atom': value['unitAmountAtom'], 'updated_at': ((value['updatedAt']).toISOString()), }; }