UNPKG

wallee

Version:
66 lines (65 loc) 4.44 kB
import { LineItemCreateFromJSON, LineItemCreateToJSON, } from './LineItemCreate'; import { PaymentLinkAddressHandlingModeFromJSON, PaymentLinkAddressHandlingModeToJSON, } from './PaymentLinkAddressHandlingMode'; import { PaymentLinkProtectionModeFromJSON, PaymentLinkProtectionModeToJSON, } from './PaymentLinkProtectionMode'; import { CreationEntityStateFromJSON, CreationEntityStateToJSON, } from './CreationEntityState'; import { PaymentMethodConfigurationFromJSON, PaymentMethodConfigurationToJSON, } from './PaymentMethodConfiguration'; /** * Check if a given object implements the PaymentLinkCreate interface. */ export function instanceOfPaymentLinkCreate(value) { if (!('protectionMode' in value) || value['protectionMode'] === undefined) return false; if (!('externalId' in value) || value['externalId'] === undefined) return false; return true; } export function PaymentLinkCreateFromJSON(json) { return PaymentLinkCreateFromJSONTyped(json, false); } export function PaymentLinkCreateFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'lineItems': json['lineItems'] == null ? undefined : (json['lineItems'].map(LineItemCreateFromJSON)), 'availableUntil': json['availableUntil'] == null ? undefined : (new Date(json['availableUntil'])), 'shippingAddressHandlingMode': json['shippingAddressHandlingMode'] == null ? undefined : PaymentLinkAddressHandlingModeFromJSON(json['shippingAddressHandlingMode']), 'allowedRedirectionDomains': json['allowedRedirectionDomains'] == null ? undefined : new Set(json['allowedRedirectionDomains']), 'name': json['name'] == null ? undefined : json['name'], 'currency': json['currency'] == null ? undefined : json['currency'], 'language': json['language'] == null ? undefined : json['language'], 'maximalNumberOfTransactions': json['maximalNumberOfTransactions'] == null ? undefined : json['maximalNumberOfTransactions'], 'availableFrom': json['availableFrom'] == null ? undefined : (new Date(json['availableFrom'])), 'allowedPaymentMethodConfigurations': json['allowedPaymentMethodConfigurations'] == null ? undefined : (new Set(json['allowedPaymentMethodConfigurations'].map(PaymentMethodConfigurationFromJSON))), 'appliedSpaceView': json['appliedSpaceView'] == null ? undefined : json['appliedSpaceView'], 'billingAddressHandlingMode': json['billingAddressHandlingMode'] == null ? undefined : PaymentLinkAddressHandlingModeFromJSON(json['billingAddressHandlingMode']), 'protectionMode': PaymentLinkProtectionModeFromJSON(json['protectionMode']), 'externalId': json['externalId'], 'state': json['state'] == null ? undefined : CreationEntityStateFromJSON(json['state']), }; } export function PaymentLinkCreateToJSON(json) { return PaymentLinkCreateToJSONTyped(json, false); } export function PaymentLinkCreateToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'lineItems': value['lineItems'] == null ? undefined : (value['lineItems'].map(LineItemCreateToJSON)), 'availableUntil': value['availableUntil'] == null ? undefined : ((value['availableUntil']).toISOString()), 'shippingAddressHandlingMode': PaymentLinkAddressHandlingModeToJSON(value['shippingAddressHandlingMode']), 'allowedRedirectionDomains': value['allowedRedirectionDomains'] == null ? undefined : Array.from(value['allowedRedirectionDomains']), 'name': value['name'], 'currency': value['currency'], 'language': value['language'], 'maximalNumberOfTransactions': value['maximalNumberOfTransactions'], 'availableFrom': value['availableFrom'] == null ? undefined : ((value['availableFrom']).toISOString()), 'allowedPaymentMethodConfigurations': value['allowedPaymentMethodConfigurations'] == null ? undefined : (Array.from(value['allowedPaymentMethodConfigurations']).map(PaymentMethodConfigurationToJSON)), 'appliedSpaceView': value['appliedSpaceView'], 'billingAddressHandlingMode': PaymentLinkAddressHandlingModeToJSON(value['billingAddressHandlingMode']), 'protectionMode': PaymentLinkProtectionModeToJSON(value['protectionMode']), 'externalId': value['externalId'], 'state': CreationEntityStateToJSON(value['state']), }; }