wallee
Version:
TypeScript/JavaScript client for wallee
135 lines (134 loc) • 11.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.instanceOfTransaction = instanceOfTransaction;
exports.TransactionFromJSON = TransactionFromJSON;
exports.TransactionFromJSONTyped = TransactionFromJSONTyped;
exports.TransactionToJSON = TransactionToJSON;
exports.TransactionToJSONTyped = TransactionToJSONTyped;
const CustomersPresence_1 = require("./CustomersPresence");
const TransactionState_1 = require("./TransactionState");
const TransactionEnvironmentSelectionStrategy_1 = require("./TransactionEnvironmentSelectionStrategy");
const Address_1 = require("./Address");
const TokenizationMode_1 = require("./TokenizationMode");
const TransactionUserInterfaceType_1 = require("./TransactionUserInterfaceType");
const LineItem_1 = require("./LineItem");
const TransactionGroup_1 = require("./TransactionGroup");
const Token_1 = require("./Token");
const PaymentTerminal_1 = require("./PaymentTerminal");
const PaymentConnectorConfiguration_1 = require("./PaymentConnectorConfiguration");
const FailureReason_1 = require("./FailureReason");
const TransactionCompletionBehavior_1 = require("./TransactionCompletionBehavior");
const Environment_1 = require("./Environment");
const ChargeAttemptEnvironment_1 = require("./ChargeAttemptEnvironment");
/**
* Check if a given object implements the Transaction interface.
*/
function instanceOfTransaction(value) {
return true;
}
function TransactionFromJSON(json) {
return TransactionFromJSONTyped(json, false);
}
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(LineItem_1.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 : (0, PaymentConnectorConfiguration_1.PaymentConnectorConfigurationFromJSON)(json['paymentConnectorConfiguration']),
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : (0, TransactionState_1.TransactionStateFromJSON)(json['state']),
'windowWidth': json['windowWidth'] == null ? undefined : json['windowWidth'],
'allowedPaymentMethodConfigurations': json['allowedPaymentMethodConfigurations'] == null ? undefined : json['allowedPaymentMethodConfigurations'],
'group': json['group'] == null ? undefined : (0, TransactionGroup_1.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 : (0, TransactionCompletionBehavior_1.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 : (0, ChargeAttemptEnvironment_1.ChargeAttemptEnvironmentFromJSON)(json['authorizationEnvironment']),
'autoConfirmationEnabled': json['autoConfirmationEnabled'] == null ? undefined : json['autoConfirmationEnabled'],
'failureReason': json['failureReason'] == null ? undefined : (0, FailureReason_1.FailureReasonFromJSON)(json['failureReason']),
'totalAppliedFees': json['totalAppliedFees'] == null ? undefined : json['totalAppliedFees'],
'customersPresence': json['customersPresence'] == null ? undefined : (0, CustomersPresence_1.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 : (0, TransactionEnvironmentSelectionStrategy_1.TransactionEnvironmentSelectionStrategyFromJSON)(json['environmentSelectionStrategy']),
'customerEmailAddress': json['customerEmailAddress'] == null ? undefined : json['customerEmailAddress'],
'windowHeight': json['windowHeight'] == null ? undefined : json['windowHeight'],
'tokenizationMode': json['tokenizationMode'] == null ? undefined : (0, TokenizationMode_1.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 : (0, TransactionUserInterfaceType_1.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 : (0, PaymentTerminal_1.PaymentTerminalFromJSON)(json['terminal']),
'endOfLife': json['endOfLife'] == null ? undefined : (new Date(json['endOfLife'])),
'token': json['token'] == null ? undefined : (0, Token_1.TokenFromJSON)(json['token']),
'environment': json['environment'] == null ? undefined : (0, Environment_1.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 : (0, Address_1.AddressFromJSON)(json['shippingAddress']),
'billingAddress': json['billingAddress'] == null ? undefined : (0, Address_1.AddressFromJSON)(json['billingAddress']),
'authorizedOn': json['authorizedOn'] == null ? undefined : (new Date(json['authorizedOn'])),
'failedUrl': json['failedUrl'] == null ? undefined : json['failedUrl'],
};
}
function TransactionToJSON(json) {
return TransactionToJSONTyped(json, false);
}
function TransactionToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'parent': TransactionToJSON(value['parent']),
'paymentConnectorConfiguration': (0, PaymentConnectorConfiguration_1.PaymentConnectorConfigurationToJSON)(value['paymentConnectorConfiguration']),
'state': (0, TransactionState_1.TransactionStateToJSON)(value['state']),
'group': (0, TransactionGroup_1.TransactionGroupToJSON)(value['group']),
'completionBehavior': (0, TransactionCompletionBehavior_1.TransactionCompletionBehaviorToJSON)(value['completionBehavior']),
'authorizationEnvironment': (0, ChargeAttemptEnvironment_1.ChargeAttemptEnvironmentToJSON)(value['authorizationEnvironment']),
'failureReason': (0, FailureReason_1.FailureReasonToJSON)(value['failureReason']),
'customersPresence': (0, CustomersPresence_1.CustomersPresenceToJSON)(value['customersPresence']),
'environmentSelectionStrategy': (0, TransactionEnvironmentSelectionStrategy_1.TransactionEnvironmentSelectionStrategyToJSON)(value['environmentSelectionStrategy']),
'tokenizationMode': (0, TokenizationMode_1.TokenizationModeToJSON)(value['tokenizationMode']),
'userInterfaceType': (0, TransactionUserInterfaceType_1.TransactionUserInterfaceTypeToJSON)(value['userInterfaceType']),
'terminal': (0, PaymentTerminal_1.PaymentTerminalToJSON)(value['terminal']),
'token': (0, Token_1.TokenToJSON)(value['token']),
'environment': (0, Environment_1.EnvironmentToJSON)(value['environment']),
'shippingAddress': (0, Address_1.AddressToJSON)(value['shippingAddress']),
'billingAddress': (0, Address_1.AddressToJSON)(value['billingAddress']),
};
}