wallee
Version:
TypeScript/JavaScript client for wallee
79 lines (78 loc) • 5.42 kB
JavaScript
import { CustomersPresenceFromJSON, CustomersPresenceToJSON, } from './CustomersPresence';
import { PaymentConnectorConfigurationFromJSON, PaymentConnectorConfigurationToJSON, } from './PaymentConnectorConfiguration';
import { WalletTypeFromJSON, WalletTypeToJSON, } from './WalletType';
import { ChargeAttemptStateFromJSON, ChargeAttemptStateToJSON, } from './ChargeAttemptState';
import { ConnectorInvocationFromJSON, ConnectorInvocationToJSON, } from './ConnectorInvocation';
import { FailureReasonFromJSON, FailureReasonToJSON, } from './FailureReason';
import { TransactionCompletionBehaviorFromJSON, TransactionCompletionBehaviorToJSON, } from './TransactionCompletionBehavior';
import { ChargeFromJSON, ChargeToJSON, } from './Charge';
import { LabelFromJSON, } from './Label';
import { PaymentTerminalFromJSON, PaymentTerminalToJSON, } from './PaymentTerminal';
import { TokenVersionFromJSON, TokenVersionToJSON, } from './TokenVersion';
import { ChargeAttemptEnvironmentFromJSON, ChargeAttemptEnvironmentToJSON, } from './ChargeAttemptEnvironment';
/**
* Check if a given object implements the ChargeAttempt interface.
*/
export function instanceOfChargeAttempt(value) {
return true;
}
export function ChargeAttemptFromJSON(json) {
return ChargeAttemptFromJSONTyped(json, false);
}
export function ChargeAttemptFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'language': json['language'] == null ? undefined : json['language'],
'salesChannel': json['salesChannel'] == null ? undefined : json['salesChannel'],
'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])),
'initializingTokenVersion': json['initializingTokenVersion'] == null ? undefined : json['initializingTokenVersion'],
'tokenVersion': json['tokenVersion'] == null ? undefined : TokenVersionFromJSON(json['tokenVersion']),
'succeededOn': json['succeededOn'] == null ? undefined : (new Date(json['succeededOn'])),
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : ChargeAttemptStateFromJSON(json['state']),
'linkedTransaction': json['linkedTransaction'] == null ? undefined : json['linkedTransaction'],
'redirectionUrl': json['redirectionUrl'] == null ? undefined : json['redirectionUrl'],
'charge': json['charge'] == null ? undefined : ChargeFromJSON(json['charge']),
'wallet': json['wallet'] == null ? undefined : WalletTypeFromJSON(json['wallet']),
'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])),
'timeZone': json['timeZone'] == null ? undefined : json['timeZone'],
'spaceViewId': json['spaceViewId'] == null ? undefined : json['spaceViewId'],
'terminal': json['terminal'] == null ? undefined : PaymentTerminalFromJSON(json['terminal']),
'userFailureMessage': json['userFailureMessage'] == null ? undefined : json['userFailureMessage'],
'completionBehavior': json['completionBehavior'] == null ? undefined : TransactionCompletionBehaviorFromJSON(json['completionBehavior']),
'version': json['version'] == null ? undefined : json['version'],
'labels': json['labels'] == null ? undefined : (new Set(json['labels'].map(LabelFromJSON))),
'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'],
'timeoutOn': json['timeoutOn'] == null ? undefined : (new Date(json['timeoutOn'])),
'environment': json['environment'] == null ? undefined : ChargeAttemptEnvironmentFromJSON(json['environment']),
'invocation': json['invocation'] == null ? undefined : ConnectorInvocationFromJSON(json['invocation']),
'connectorConfiguration': json['connectorConfiguration'] == null ? undefined : PaymentConnectorConfigurationFromJSON(json['connectorConfiguration']),
'nextUpdateOn': json['nextUpdateOn'] == null ? undefined : (new Date(json['nextUpdateOn'])),
'failureReason': json['failureReason'] == null ? undefined : FailureReasonFromJSON(json['failureReason']),
'customersPresence': json['customersPresence'] == null ? undefined : CustomersPresenceFromJSON(json['customersPresence']),
'failedOn': json['failedOn'] == null ? undefined : (new Date(json['failedOn'])),
};
}
export function ChargeAttemptToJSON(json) {
return ChargeAttemptToJSONTyped(json, false);
}
export function ChargeAttemptToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'tokenVersion': TokenVersionToJSON(value['tokenVersion']),
'state': ChargeAttemptStateToJSON(value['state']),
'charge': ChargeToJSON(value['charge']),
'wallet': WalletTypeToJSON(value['wallet']),
'terminal': PaymentTerminalToJSON(value['terminal']),
'completionBehavior': TransactionCompletionBehaviorToJSON(value['completionBehavior']),
'environment': ChargeAttemptEnvironmentToJSON(value['environment']),
'invocation': ConnectorInvocationToJSON(value['invocation']),
'connectorConfiguration': PaymentConnectorConfigurationToJSON(value['connectorConfiguration']),
'failureReason': FailureReasonToJSON(value['failureReason']),
'customersPresence': CustomersPresenceToJSON(value['customersPresence']),
};
}