UNPKG

wallee

Version:
74 lines (73 loc) 4.95 kB
import { AddressFromJSON, AddressToJSON, } from './Address'; import { PaymentConnectorConfigurationFromJSON, PaymentConnectorConfigurationToJSON, } from './PaymentConnectorConfiguration'; import { PaymentInformationHashFromJSON, } from './PaymentInformationHash'; import { TokenVersionStateFromJSON, TokenVersionStateToJSON, } from './TokenVersionState'; import { LabelFromJSON, } from './Label'; import { PaymentMethodFromJSON, PaymentMethodToJSON, } from './PaymentMethod'; import { TokenFromJSON, TokenToJSON, } from './Token'; import { PaymentMethodBrandFromJSON, PaymentMethodBrandToJSON, } from './PaymentMethodBrand'; import { ChargeAttemptEnvironmentFromJSON, ChargeAttemptEnvironmentToJSON, } from './ChargeAttemptEnvironment'; import { TokenVersionRetryStrategyFromJSON, TokenVersionRetryStrategyToJSON, } from './TokenVersionRetryStrategy'; import { TokenVersionTypeFromJSON, TokenVersionTypeToJSON, } from './TokenVersionType'; /** * Check if a given object implements the TokenVersion interface. */ export function instanceOfTokenVersion(value) { return true; } export function TokenVersionFromJSON(json) { return TokenVersionFromJSONTyped(json, false); } export function TokenVersionFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'paymentInformationHashes': json['paymentInformationHashes'] == null ? undefined : (new Set(json['paymentInformationHashes'].map(PaymentInformationHashFromJSON))), 'language': json['language'] == null ? undefined : json['language'], 'type': json['type'] == null ? undefined : TokenVersionTypeFromJSON(json['type']), 'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])), 'retryIn': json['retryIn'] == null ? undefined : json['retryIn'], 'paymentConnectorConfiguration': json['paymentConnectorConfiguration'] == null ? undefined : PaymentConnectorConfigurationFromJSON(json['paymentConnectorConfiguration']), 'obsoletedOn': json['obsoletedOn'] == null ? undefined : (new Date(json['obsoletedOn'])), 'expiresOn': json['expiresOn'] == null ? undefined : (new Date(json['expiresOn'])), 'iconUrl': json['iconUrl'] == null ? undefined : json['iconUrl'], 'id': json['id'] == null ? undefined : json['id'], 'state': json['state'] == null ? undefined : TokenVersionStateFromJSON(json['state']), 'processorToken': json['processorToken'] == null ? undefined : json['processorToken'], 'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])), 'paymentMethodBrand': json['paymentMethodBrand'] == null ? undefined : PaymentMethodBrandFromJSON(json['paymentMethodBrand']), 'version': json['version'] == null ? undefined : json['version'], 'lastRetriedOn': json['lastRetriedOn'] == null ? undefined : (new Date(json['lastRetriedOn'])), 'labels': json['labels'] == null ? undefined : (new Set(json['labels'].map(LabelFromJSON))), 'token': json['token'] == null ? undefined : TokenFromJSON(json['token']), 'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'], 'environment': json['environment'] == null ? undefined : ChargeAttemptEnvironmentFromJSON(json['environment']), 'activatedOn': json['activatedOn'] == null ? undefined : (new Date(json['activatedOn'])), 'name': json['name'] == null ? undefined : json['name'], 'paymentMethod': json['paymentMethod'] == null ? undefined : PaymentMethodFromJSON(json['paymentMethod']), 'shippingAddress': json['shippingAddress'] == null ? undefined : AddressFromJSON(json['shippingAddress']), 'billingAddress': json['billingAddress'] == null ? undefined : AddressFromJSON(json['billingAddress']), 'retryStrategy': json['retryStrategy'] == null ? undefined : TokenVersionRetryStrategyFromJSON(json['retryStrategy']), }; } export function TokenVersionToJSON(json) { return TokenVersionToJSONTyped(json, false); } export function TokenVersionToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'type': TokenVersionTypeToJSON(value['type']), 'paymentConnectorConfiguration': PaymentConnectorConfigurationToJSON(value['paymentConnectorConfiguration']), 'state': TokenVersionStateToJSON(value['state']), 'paymentMethodBrand': PaymentMethodBrandToJSON(value['paymentMethodBrand']), 'token': TokenToJSON(value['token']), 'environment': ChargeAttemptEnvironmentToJSON(value['environment']), 'paymentMethod': PaymentMethodToJSON(value['paymentMethod']), 'shippingAddress': AddressToJSON(value['shippingAddress']), 'billingAddress': AddressToJSON(value['billingAddress']), 'retryStrategy': TokenVersionRetryStrategyToJSON(value['retryStrategy']), }; }