UNPKG

wallee

Version:
81 lines (80 loc) 4.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.instanceOfRefund = instanceOfRefund; exports.RefundFromJSON = RefundFromJSON; exports.RefundFromJSONTyped = RefundFromJSONTyped; exports.RefundToJSON = RefundToJSON; exports.RefundToJSONTyped = RefundToJSONTyped; const Transaction_1 = require("./Transaction"); const FailureReason_1 = require("./FailureReason"); const RefundType_1 = require("./RefundType"); const Label_1 = require("./Label"); const Environment_1 = require("./Environment"); const LineItem_1 = require("./LineItem"); const Tax_1 = require("./Tax"); const LineItemReduction_1 = require("./LineItemReduction"); const RefundState_1 = require("./RefundState"); /** * Check if a given object implements the Refund interface. */ function instanceOfRefund(value) { return true; } function RefundFromJSON(json) { return RefundFromJSONTyped(json, false); } function RefundFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'totalSettledAmount': json['totalSettledAmount'] == null ? undefined : json['totalSettledAmount'], 'reductions': json['reductions'] == null ? undefined : (json['reductions'].map(LineItemReduction_1.LineItemReductionFromJSON)), 'baseLineItems': json['baseLineItems'] == null ? undefined : (json['baseLineItems'].map(LineItem_1.LineItemFromJSON)), 'processingOn': json['processingOn'] == null ? undefined : (new Date(json['processingOn'])), 'taxes': json['taxes'] == null ? undefined : (new Set(json['taxes'].map(Tax_1.TaxFromJSON))), 'language': json['language'] == null ? undefined : json['language'], 'type': json['type'] == null ? undefined : (0, RefundType_1.RefundTypeFromJSON)(json['type']), 'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])), 'lineItems': json['lineItems'] == null ? undefined : (json['lineItems'].map(LineItem_1.LineItemFromJSON)), 'metaData': json['metaData'] == null ? undefined : json['metaData'], 'succeededOn': json['succeededOn'] == null ? undefined : (new Date(json['succeededOn'])), 'reducedLineItems': json['reducedLineItems'] == null ? undefined : (json['reducedLineItems'].map(LineItem_1.LineItemFromJSON)), 'id': json['id'] == null ? undefined : json['id'], 'state': json['state'] == null ? undefined : (0, RefundState_1.RefundStateFromJSON)(json['state']), 'merchantReference': json['merchantReference'] == null ? undefined : json['merchantReference'], 'completion': json['completion'] == null ? undefined : json['completion'], 'amount': json['amount'] == null ? undefined : json['amount'], 'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])), 'externalId': json['externalId'] == null ? undefined : json['externalId'], 'timeZone': json['timeZone'] == null ? undefined : json['timeZone'], 'version': json['version'] == null ? undefined : json['version'], 'labels': json['labels'] == null ? undefined : (new Set(json['labels'].map(Label_1.LabelFromJSON))), 'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'], 'timeoutOn': json['timeoutOn'] == null ? undefined : (new Date(json['timeoutOn'])), 'environment': json['environment'] == null ? undefined : (0, Environment_1.EnvironmentFromJSON)(json['environment']), 'createdBy': json['createdBy'] == null ? undefined : json['createdBy'], 'nextUpdateOn': json['nextUpdateOn'] == null ? undefined : (new Date(json['nextUpdateOn'])), 'updatedInvoice': json['updatedInvoice'] == null ? undefined : json['updatedInvoice'], 'failureReason': json['failureReason'] == null ? undefined : (0, FailureReason_1.FailureReasonFromJSON)(json['failureReason']), 'totalAppliedFees': json['totalAppliedFees'] == null ? undefined : json['totalAppliedFees'], 'failedOn': json['failedOn'] == null ? undefined : (new Date(json['failedOn'])), 'transaction': json['transaction'] == null ? undefined : (0, Transaction_1.TransactionFromJSON)(json['transaction']), 'processorReference': json['processorReference'] == null ? undefined : json['processorReference'], }; } function RefundToJSON(json) { return RefundToJSONTyped(json, false); } function RefundToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'type': (0, RefundType_1.RefundTypeToJSON)(value['type']), 'state': (0, RefundState_1.RefundStateToJSON)(value['state']), 'environment': (0, Environment_1.EnvironmentToJSON)(value['environment']), 'failureReason': (0, FailureReason_1.FailureReasonToJSON)(value['failureReason']), 'transaction': (0, Transaction_1.TransactionToJSON)(value['transaction']), }; }