wallee
Version:
TypeScript/JavaScript client for wallee
128 lines (127 loc) • 10.7 kB
JavaScript
import { CustomersPresenceFromJSON, CustomersPresenceToJSON, } from './CustomersPresence';
import { TransactionStateFromJSON, TransactionStateToJSON, } from './TransactionState';
import { TransactionEnvironmentSelectionStrategyFromJSON, TransactionEnvironmentSelectionStrategyToJSON, } from './TransactionEnvironmentSelectionStrategy';
import { AddressFromJSON, AddressToJSON, } from './Address';
import { TokenizationModeFromJSON, TokenizationModeToJSON, } from './TokenizationMode';
import { TransactionUserInterfaceTypeFromJSON, TransactionUserInterfaceTypeToJSON, } from './TransactionUserInterfaceType';
import { LineItemFromJSON, } from './LineItem';
import { TransactionGroupFromJSON, TransactionGroupToJSON, } from './TransactionGroup';
import { TokenFromJSON, TokenToJSON, } from './Token';
import { PaymentTerminalFromJSON, PaymentTerminalToJSON, } from './PaymentTerminal';
import { PaymentConnectorConfigurationFromJSON, PaymentConnectorConfigurationToJSON, } from './PaymentConnectorConfiguration';
import { FailureReasonFromJSON, FailureReasonToJSON, } from './FailureReason';
import { TransactionCompletionBehaviorFromJSON, TransactionCompletionBehaviorToJSON, } from './TransactionCompletionBehavior';
import { EnvironmentFromJSON, EnvironmentToJSON, } from './Environment';
import { ChargeAttemptEnvironmentFromJSON, ChargeAttemptEnvironmentToJSON, } from './ChargeAttemptEnvironment';
/**
* Check if a given object implements the Transaction interface.
*/
export function instanceOfTransaction(value) {
return true;
}
export function TransactionFromJSON(json) {
return TransactionFromJSONTyped(json, false);
}
export function TransactionFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'parent': json['parent'] == null ? undefined : TransactionFromJSON(json['parent']),
'totalSettledAmount': json['totalSettledAmount'] == null ? undefined : json['totalSettledAmount'],
'deviceSessionIdentifier': json['deviceSessionIdentifier'] == null ? undefined : json['deviceSessionIdentifier'],
'processingOn': json['processingOn'] == null ? undefined : (new Date(json['processingOn'])),
'invoiceMerchantReference': json['invoiceMerchantReference'] == null ? undefined : json['invoiceMerchantReference'],
'language': json['language'] == null ? undefined : json['language'],
'confirmedOn': json['confirmedOn'] == null ? undefined : (new Date(json['confirmedOn'])),
'lineItems': json['lineItems'] == null ? undefined : (json['lineItems'].map(LineItemFromJSON)),
'acceptLanguageHeader': json['acceptLanguageHeader'] == null ? undefined : json['acceptLanguageHeader'],
'javaEnabled': json['javaEnabled'] == null ? undefined : json['javaEnabled'],
'confirmedBy': json['confirmedBy'] == null ? undefined : json['confirmedBy'],
'paymentConnectorConfiguration': json['paymentConnectorConfiguration'] == null ? undefined : PaymentConnectorConfigurationFromJSON(json['paymentConnectorConfiguration']),
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : TransactionStateFromJSON(json['state']),
'windowWidth': json['windowWidth'] == null ? undefined : json['windowWidth'],
'allowedPaymentMethodConfigurations': json['allowedPaymentMethodConfigurations'] == null ? undefined : json['allowedPaymentMethodConfigurations'],
'group': json['group'] == null ? undefined : TransactionGroupFromJSON(json['group']),
'chargeRetryEnabled': json['chargeRetryEnabled'] == null ? undefined : json['chargeRetryEnabled'],
'acceptHeader': json['acceptHeader'] == null ? undefined : json['acceptHeader'],
'userAgentHeader': json['userAgentHeader'] == null ? undefined : json['userAgentHeader'],
'shippingMethod': json['shippingMethod'] == null ? undefined : json['shippingMethod'],
'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])),
'successUrl': json['successUrl'] == null ? undefined : json['successUrl'],
'timeZone': json['timeZone'] == null ? undefined : json['timeZone'],
'spaceViewId': json['spaceViewId'] == null ? undefined : json['spaceViewId'],
'userFailureMessage': json['userFailureMessage'] == null ? undefined : json['userFailureMessage'],
'completionBehavior': json['completionBehavior'] == null ? undefined : TransactionCompletionBehaviorFromJSON(json['completionBehavior']),
'version': json['version'] == null ? undefined : json['version'],
'internetProtocolAddressCountry': json['internetProtocolAddressCountry'] == null ? undefined : json['internetProtocolAddressCountry'],
'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'],
'deliveryDecisionMadeOn': json['deliveryDecisionMadeOn'] == null ? undefined : (new Date(json['deliveryDecisionMadeOn'])),
'authorizationEnvironment': json['authorizationEnvironment'] == null ? undefined : ChargeAttemptEnvironmentFromJSON(json['authorizationEnvironment']),
'autoConfirmationEnabled': json['autoConfirmationEnabled'] == null ? undefined : json['autoConfirmationEnabled'],
'failureReason': json['failureReason'] == null ? undefined : FailureReasonFromJSON(json['failureReason']),
'totalAppliedFees': json['totalAppliedFees'] == null ? undefined : json['totalAppliedFees'],
'customersPresence': json['customersPresence'] == null ? undefined : CustomersPresenceFromJSON(json['customersPresence']),
'failedOn': json['failedOn'] == null ? undefined : (new Date(json['failedOn'])),
'refundedAmount': json['refundedAmount'] == null ? undefined : json['refundedAmount'],
'authorizationAmount': json['authorizationAmount'] == null ? undefined : json['authorizationAmount'],
'screenWidth': json['screenWidth'] == null ? undefined : json['screenWidth'],
'environmentSelectionStrategy': json['environmentSelectionStrategy'] == null ? undefined : TransactionEnvironmentSelectionStrategyFromJSON(json['environmentSelectionStrategy']),
'customerEmailAddress': json['customerEmailAddress'] == null ? undefined : json['customerEmailAddress'],
'windowHeight': json['windowHeight'] == null ? undefined : json['windowHeight'],
'tokenizationMode': json['tokenizationMode'] == null ? undefined : TokenizationModeFromJSON(json['tokenizationMode']),
'authorizationTimeoutOn': json['authorizationTimeoutOn'] == null ? undefined : (new Date(json['authorizationTimeoutOn'])),
'allowedPaymentMethodBrands': json['allowedPaymentMethodBrands'] == null ? undefined : json['allowedPaymentMethodBrands'],
'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])),
'metaData': json['metaData'] == null ? undefined : json['metaData'],
'emailsDisabled': json['emailsDisabled'] == null ? undefined : json['emailsDisabled'],
'userInterfaceType': json['userInterfaceType'] == null ? undefined : TransactionUserInterfaceTypeFromJSON(json['userInterfaceType']),
'customerId': json['customerId'] == null ? undefined : json['customerId'],
'currency': json['currency'] == null ? undefined : json['currency'],
'merchantReference': json['merchantReference'] == null ? undefined : json['merchantReference'],
'authorizationSalesChannel': json['authorizationSalesChannel'] == null ? undefined : json['authorizationSalesChannel'],
'yearsToKeep': json['yearsToKeep'] == null ? undefined : json['yearsToKeep'],
'completedAmount': json['completedAmount'] == null ? undefined : json['completedAmount'],
'screenHeight': json['screenHeight'] == null ? undefined : json['screenHeight'],
'internetProtocolAddress': json['internetProtocolAddress'] == null ? undefined : json['internetProtocolAddress'],
'terminal': json['terminal'] == null ? undefined : PaymentTerminalFromJSON(json['terminal']),
'endOfLife': json['endOfLife'] == null ? undefined : (new Date(json['endOfLife'])),
'token': json['token'] == null ? undefined : TokenFromJSON(json['token']),
'environment': json['environment'] == null ? undefined : EnvironmentFromJSON(json['environment']),
'screenColorDepth': json['screenColorDepth'] == null ? undefined : json['screenColorDepth'],
'createdBy': json['createdBy'] == null ? undefined : json['createdBy'],
'completedOn': json['completedOn'] == null ? undefined : (new Date(json['completedOn'])),
'completionTimeoutOn': json['completionTimeoutOn'] == null ? undefined : (new Date(json['completionTimeoutOn'])),
'shippingAddress': json['shippingAddress'] == null ? undefined : AddressFromJSON(json['shippingAddress']),
'billingAddress': json['billingAddress'] == null ? undefined : AddressFromJSON(json['billingAddress']),
'authorizedOn': json['authorizedOn'] == null ? undefined : (new Date(json['authorizedOn'])),
'failedUrl': json['failedUrl'] == null ? undefined : json['failedUrl'],
};
}
export function TransactionToJSON(json) {
return TransactionToJSONTyped(json, false);
}
export function TransactionToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'parent': TransactionToJSON(value['parent']),
'paymentConnectorConfiguration': PaymentConnectorConfigurationToJSON(value['paymentConnectorConfiguration']),
'state': TransactionStateToJSON(value['state']),
'group': TransactionGroupToJSON(value['group']),
'completionBehavior': TransactionCompletionBehaviorToJSON(value['completionBehavior']),
'authorizationEnvironment': ChargeAttemptEnvironmentToJSON(value['authorizationEnvironment']),
'failureReason': FailureReasonToJSON(value['failureReason']),
'customersPresence': CustomersPresenceToJSON(value['customersPresence']),
'environmentSelectionStrategy': TransactionEnvironmentSelectionStrategyToJSON(value['environmentSelectionStrategy']),
'tokenizationMode': TokenizationModeToJSON(value['tokenizationMode']),
'userInterfaceType': TransactionUserInterfaceTypeToJSON(value['userInterfaceType']),
'terminal': PaymentTerminalToJSON(value['terminal']),
'token': TokenToJSON(value['token']),
'environment': EnvironmentToJSON(value['environment']),
'shippingAddress': AddressToJSON(value['shippingAddress']),
'billingAddress': AddressToJSON(value['billingAddress']),
};
}