wallee
Version:
TypeScript/JavaScript client for wallee
49 lines (48 loc) • 2.38 kB
JavaScript
import { TransactionFromJSON, TransactionToJSON, } from './Transaction';
import { ChargeTypeFromJSON, ChargeTypeToJSON, } from './ChargeType';
import { FailureReasonFromJSON, FailureReasonToJSON, } from './FailureReason';
import { ChargeStateFromJSON, ChargeStateToJSON, } from './ChargeState';
/**
* Check if a given object implements the Charge interface.
*/
export function instanceOfCharge(value) {
return true;
}
export function ChargeFromJSON(json) {
return ChargeFromJSONTyped(json, false);
}
export function ChargeFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])),
'timeZone': json['timeZone'] == null ? undefined : json['timeZone'],
'language': json['language'] == null ? undefined : json['language'],
'spaceViewId': json['spaceViewId'] == null ? undefined : json['spaceViewId'],
'type': json['type'] == null ? undefined : ChargeTypeFromJSON(json['type']),
'userFailureMessage': json['userFailureMessage'] == null ? undefined : json['userFailureMessage'],
'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])),
'version': json['version'] == null ? undefined : json['version'],
'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'],
'timeoutOn': json['timeoutOn'] == null ? undefined : (new Date(json['timeoutOn'])),
'failureReason': json['failureReason'] == null ? undefined : FailureReasonFromJSON(json['failureReason']),
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : ChargeStateFromJSON(json['state']),
'transaction': json['transaction'] == null ? undefined : TransactionFromJSON(json['transaction']),
};
}
export function ChargeToJSON(json) {
return ChargeToJSONTyped(json, false);
}
export function ChargeToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'type': ChargeTypeToJSON(value['type']),
'failureReason': FailureReasonToJSON(value['failureReason']),
'state': ChargeStateToJSON(value['state']),
'transaction': TransactionToJSON(value['transaction']),
};
}