UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

158 lines (157 loc) 8.38 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.instanceOfChargeExternal = instanceOfChargeExternal; exports.ChargeExternalFromJSON = ChargeExternalFromJSON; exports.ChargeExternalFromJSONTyped = ChargeExternalFromJSONTyped; exports.ChargeExternalToJSON = ChargeExternalToJSON; exports.ChargeExternalToJSONTyped = ChargeExternalToJSONTyped; const TokenizedCreditCardExternal_1 = require("./TokenizedCreditCardExternal"); const PaymentInitiator_1 = require("./PaymentInitiator"); const PaymentMethodExternal_1 = require("./PaymentMethodExternal"); const CustomerExternal_1 = require("./CustomerExternal"); const ChargeStatusEnum_1 = require("./ChargeStatusEnum"); const CurrencyEnum_1 = require("./CurrencyEnum"); const SubscriptionExternal_1 = require("./SubscriptionExternal"); const ObjectName_1 = require("./ObjectName"); const VerificationResults_1 = require("./VerificationResults"); /** * Check if a given object implements the ChargeExternal interface. */ function instanceOfChargeExternal(value) { if (!('amountAtom' in value) || value['amountAtom'] === undefined) return false; if (!('createdAt' in value) || value['createdAt'] === undefined) return false; if (!('currency' in value) || value['currency'] === undefined) return false; if (!('customerId' in value) || value['customerId'] === undefined) return false; if (!('disputed' in value) || value['disputed'] === undefined) return false; if (!('failureCode' in value) || value['failureCode'] === undefined) return false; if (!('failureMessage' in value) || value['failureMessage'] === undefined) return false; if (!('id' in value) || value['id'] === undefined) return false; if (!('invoiceId' in value) || value['invoiceId'] === undefined) return false; if (!('paymentIntentId' in value) || value['paymentIntentId'] === undefined) return false; if (!('paymentIntentMappingId' in value) || value['paymentIntentMappingId'] === undefined) return false; if (!('paymentMethodId' in value) || value['paymentMethodId'] === undefined) return false; if (!('paymentProcessorId' in value) || value['paymentProcessorId'] === undefined) return false; if (!('paymentProcessorName' in value) || value['paymentProcessorName'] === undefined) return false; if (!('providerTypeFeeAmountAtom' in value) || value['providerTypeFeeAmountAtom'] === undefined) return false; if (!('refunded' in value) || value['refunded'] === undefined) return false; if (!('refundedAmountAtom' in value) || value['refundedAmountAtom'] === undefined) return false; if (!('status' in value) || value['status'] === undefined) return false; if (!('totalChargeAmountAtom' in value) || value['totalChargeAmountAtom'] === undefined) return false; if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false; return true; } function ChargeExternalFromJSON(json) { return ChargeExternalFromJSONTyped(json, false); } function ChargeExternalFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'amountAtom': json['amount_atom'], 'createdAt': (new Date(json['created_at'])), 'creditCard': json['credit_card'] == null ? undefined : (0, TokenizedCreditCardExternal_1.TokenizedCreditCardExternalFromJSON)(json['credit_card']), 'currency': (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']), 'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'], 'customer': json['customer'] == null ? undefined : (0, CustomerExternal_1.CustomerExternalFromJSON)(json['customer']), 'customerId': json['customer_id'], 'disputed': json['disputed'], 'executor': json['executor'] == null ? undefined : (0, PaymentInitiator_1.PaymentInitiatorFromJSON)(json['executor']), 'failureCode': json['failure_code'], 'failureMessage': json['failure_message'], 'id': json['id'], 'invoiceId': json['invoice_id'], 'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'], 'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']), 'paymentIntentId': json['payment_intent_id'], 'paymentIntentMappingId': json['payment_intent_mapping_id'], 'paymentMethod': json['payment_method'] == null ? undefined : (0, PaymentMethodExternal_1.PaymentMethodExternalFromJSON)(json['payment_method']), 'paymentMethodId': json['payment_method_id'], 'paymentProcessorId': json['payment_processor_id'], 'paymentProcessorName': json['payment_processor_name'], 'processorMetadata': json['processor_metadata'] == null ? undefined : json['processor_metadata'], 'providerTypeFeeAmountAtom': json['provider_type_fee_amount_atom'], 'refunded': json['refunded'], 'refundedAmountAtom': json['refunded_amount_atom'], 'status': (0, ChargeStatusEnum_1.ChargeStatusEnumFromJSON)(json['status']), 'subscriptionIds': json['subscription_ids'] == null ? undefined : json['subscription_ids'], 'subscriptions': json['subscriptions'] == null ? undefined : (json['subscriptions'].map(SubscriptionExternal_1.SubscriptionExternalFromJSON)), 'totalChargeAmountAtom': json['total_charge_amount_atom'], 'updatedAt': (new Date(json['updated_at'])), 'verificationResults': json['verification_results'] == null ? undefined : (0, VerificationResults_1.VerificationResultsFromJSON)(json['verification_results']), }; } function ChargeExternalToJSON(json) { return ChargeExternalToJSONTyped(json, false); } function ChargeExternalToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'amount_atom': value['amountAtom'], 'created_at': ((value['createdAt']).toISOString()), 'credit_card': (0, TokenizedCreditCardExternal_1.TokenizedCreditCardExternalToJSON)(value['creditCard']), 'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']), 'custom_fields': value['customFields'], 'customer': (0, CustomerExternal_1.CustomerExternalToJSON)(value['customer']), 'customer_id': value['customerId'], 'disputed': value['disputed'], 'executor': (0, PaymentInitiator_1.PaymentInitiatorToJSON)(value['executor']), 'failure_code': value['failureCode'], 'failure_message': value['failureMessage'], 'id': value['id'], 'invoice_id': value['invoiceId'], 'is_deleted': value['isDeleted'], 'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']), 'payment_intent_id': value['paymentIntentId'], 'payment_intent_mapping_id': value['paymentIntentMappingId'], 'payment_method': (0, PaymentMethodExternal_1.PaymentMethodExternalToJSON)(value['paymentMethod']), 'payment_method_id': value['paymentMethodId'], 'payment_processor_id': value['paymentProcessorId'], 'payment_processor_name': value['paymentProcessorName'], 'processor_metadata': value['processorMetadata'], 'provider_type_fee_amount_atom': value['providerTypeFeeAmountAtom'], 'refunded': value['refunded'], 'refunded_amount_atom': value['refundedAmountAtom'], 'status': (0, ChargeStatusEnum_1.ChargeStatusEnumToJSON)(value['status']), 'subscription_ids': value['subscriptionIds'], 'subscriptions': value['subscriptions'] == null ? undefined : (value['subscriptions'].map(SubscriptionExternal_1.SubscriptionExternalToJSON)), 'total_charge_amount_atom': value['totalChargeAmountAtom'], 'updated_at': ((value['updatedAt']).toISOString()), 'verification_results': (0, VerificationResults_1.VerificationResultsToJSON)(value['verificationResults']), }; }