wallee
Version:
TypeScript/JavaScript client for wallee
74 lines (73 loc) • 4.58 kB
JavaScript
import { TransactionFromJSON, TransactionToJSON, } from './Transaction';
import { FailureReasonFromJSON, FailureReasonToJSON, } from './FailureReason';
import { RefundTypeFromJSON, RefundTypeToJSON, } from './RefundType';
import { LabelFromJSON, } from './Label';
import { EnvironmentFromJSON, EnvironmentToJSON, } from './Environment';
import { LineItemFromJSON, } from './LineItem';
import { TaxFromJSON, } from './Tax';
import { LineItemReductionFromJSON, } from './LineItemReduction';
import { RefundStateFromJSON, RefundStateToJSON, } from './RefundState';
/**
* Check if a given object implements the Refund interface.
*/
export function instanceOfRefund(value) {
return true;
}
export function RefundFromJSON(json) {
return RefundFromJSONTyped(json, false);
}
export 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(LineItemReductionFromJSON)),
'baseLineItems': json['baseLineItems'] == null ? undefined : (json['baseLineItems'].map(LineItemFromJSON)),
'processingOn': json['processingOn'] == null ? undefined : (new Date(json['processingOn'])),
'taxes': json['taxes'] == null ? undefined : (new Set(json['taxes'].map(TaxFromJSON))),
'language': json['language'] == null ? undefined : json['language'],
'type': json['type'] == null ? undefined : RefundTypeFromJSON(json['type']),
'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])),
'lineItems': json['lineItems'] == null ? undefined : (json['lineItems'].map(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(LineItemFromJSON)),
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : 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(LabelFromJSON))),
'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'],
'timeoutOn': json['timeoutOn'] == null ? undefined : (new Date(json['timeoutOn'])),
'environment': json['environment'] == null ? undefined : 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 : FailureReasonFromJSON(json['failureReason']),
'totalAppliedFees': json['totalAppliedFees'] == null ? undefined : json['totalAppliedFees'],
'failedOn': json['failedOn'] == null ? undefined : (new Date(json['failedOn'])),
'transaction': json['transaction'] == null ? undefined : TransactionFromJSON(json['transaction']),
'processorReference': json['processorReference'] == null ? undefined : json['processorReference'],
};
}
export function RefundToJSON(json) {
return RefundToJSONTyped(json, false);
}
export function RefundToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'type': RefundTypeToJSON(value['type']),
'state': RefundStateToJSON(value['state']),
'environment': EnvironmentToJSON(value['environment']),
'failureReason': FailureReasonToJSON(value['failureReason']),
'transaction': TransactionToJSON(value['transaction']),
};
}