wallee
Version:
TypeScript/JavaScript client for wallee
59 lines (58 loc) • 3.62 kB
JavaScript
import { TransactionFromJSON, TransactionToJSON, } from './Transaction';
import { SubscriptionLedgerEntryFromJSON, } from './SubscriptionLedgerEntry';
import { SubscriptionFromJSON, SubscriptionToJSON, } from './Subscription';
import { SubscriptionChargeStateFromJSON, SubscriptionChargeStateToJSON, } from './SubscriptionChargeState';
import { SubscriptionChargeProcessingTypeFromJSON, SubscriptionChargeProcessingTypeToJSON, } from './SubscriptionChargeProcessingType';
import { SubscriptionChargeTypeFromJSON, SubscriptionChargeTypeToJSON, } from './SubscriptionChargeType';
/**
* Check if a given object implements the SubscriptionCharge interface.
*/
export function instanceOfSubscriptionCharge(value) {
return true;
}
export function SubscriptionChargeFromJSON(json) {
return SubscriptionChargeFromJSONTyped(json, false);
}
export function SubscriptionChargeFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'discardedOn': json['discardedOn'] == null ? undefined : (new Date(json['discardedOn'])),
'plannedExecutionDate': json['plannedExecutionDate'] == null ? undefined : (new Date(json['plannedExecutionDate'])),
'processingType': json['processingType'] == null ? undefined : SubscriptionChargeProcessingTypeFromJSON(json['processingType']),
'ledgerEntries': json['ledgerEntries'] == null ? undefined : (new Set(json['ledgerEntries'].map(SubscriptionLedgerEntryFromJSON))),
'discardedBy': json['discardedBy'] == null ? undefined : json['discardedBy'],
'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])),
'externalId': json['externalId'] == null ? undefined : json['externalId'],
'successUrl': json['successUrl'] == null ? undefined : json['successUrl'],
'language': json['language'] == null ? undefined : json['language'],
'subscription': json['subscription'] == null ? undefined : SubscriptionFromJSON(json['subscription']),
'type': json['type'] == null ? undefined : SubscriptionChargeTypeFromJSON(json['type']),
'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])),
'version': json['version'] == null ? undefined : json['version'],
'reference': json['reference'] == null ? undefined : json['reference'],
'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'],
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : SubscriptionChargeStateFromJSON(json['state']),
'failedOn': json['failedOn'] == null ? undefined : (new Date(json['failedOn'])),
'transaction': json['transaction'] == null ? undefined : TransactionFromJSON(json['transaction']),
'failedUrl': json['failedUrl'] == null ? undefined : json['failedUrl'],
'succeedOn': json['succeedOn'] == null ? undefined : (new Date(json['succeedOn'])),
};
}
export function SubscriptionChargeToJSON(json) {
return SubscriptionChargeToJSONTyped(json, false);
}
export function SubscriptionChargeToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'processingType': SubscriptionChargeProcessingTypeToJSON(value['processingType']),
'subscription': SubscriptionToJSON(value['subscription']),
'type': SubscriptionChargeTypeToJSON(value['type']),
'state': SubscriptionChargeStateToJSON(value['state']),
'transaction': TransactionToJSON(value['transaction']),
};
}