@getopenpay/client
Version:
OpenPay API TypeScript SDK
80 lines (79 loc) • 4.32 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* OpenPay API
* super charge your subscription management.
*
* The version of the OpenAPI document: 1.2.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.instanceOfUpdateSubscriptionRequest = instanceOfUpdateSubscriptionRequest;
exports.UpdateSubscriptionRequestFromJSON = UpdateSubscriptionRequestFromJSON;
exports.UpdateSubscriptionRequestFromJSONTyped = UpdateSubscriptionRequestFromJSONTyped;
exports.UpdateSubscriptionRequestToJSON = UpdateSubscriptionRequestToJSON;
exports.UpdateSubscriptionRequestToJSONTyped = UpdateSubscriptionRequestToJSONTyped;
const CollectionMethodEnum_1 = require("./CollectionMethodEnum");
const ProrationEnum_1 = require("./ProrationEnum");
const InlineSubscriptionItemUpdate_1 = require("./InlineSubscriptionItemUpdate");
/**
* Check if a given object implements the UpdateSubscriptionRequest interface.
*/
function instanceOfUpdateSubscriptionRequest(value) {
return true;
}
function UpdateSubscriptionRequestFromJSON(json) {
return UpdateSubscriptionRequestFromJSONTyped(json, false);
}
function UpdateSubscriptionRequestFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'cancelAtEnd': json['cancel_at_end'] == null ? undefined : json['cancel_at_end'],
'collectionMethod': json['collection_method'] == null ? undefined : (0, CollectionMethodEnum_1.CollectionMethodEnumFromJSON)(json['collection_method']),
'couponId': json['coupon_id'] == null ? undefined : json['coupon_id'],
'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'],
'description': json['description'] == null ? undefined : json['description'],
'isPreview': json['is_preview'] == null ? undefined : json['is_preview'],
'items': json['items'] == null ? undefined : (json['items'].map(InlineSubscriptionItemUpdate_1.InlineSubscriptionItemUpdateFromJSON)),
'netD': json['net_d'] == null ? undefined : json['net_d'],
'newPeriodEnd': json['new_period_end'] == null ? undefined : (new Date(json['new_period_end'])),
'paymentMethodId': json['payment_method_id'] == null ? undefined : json['payment_method_id'],
'previewRenewalInvoices': json['preview_renewal_invoices'] == null ? undefined : json['preview_renewal_invoices'],
'promotionCode': json['promotion_code'] == null ? undefined : json['promotion_code'],
'prorationBehavior': json['proration_behavior'] == null ? undefined : (0, ProrationEnum_1.ProrationEnumFromJSON)(json['proration_behavior']),
'trialEnd': json['trial_end'] == null ? undefined : (new Date(json['trial_end'])),
'trialPeriodDays': json['trial_period_days'] == null ? undefined : json['trial_period_days'],
};
}
function UpdateSubscriptionRequestToJSON(json) {
return UpdateSubscriptionRequestToJSONTyped(json, false);
}
function UpdateSubscriptionRequestToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'cancel_at_end': value['cancelAtEnd'],
'collection_method': (0, CollectionMethodEnum_1.CollectionMethodEnumToJSON)(value['collectionMethod']),
'coupon_id': value['couponId'],
'custom_fields': value['customFields'],
'description': value['description'],
'is_preview': value['isPreview'],
'items': value['items'] == null ? undefined : (value['items'].map(InlineSubscriptionItemUpdate_1.InlineSubscriptionItemUpdateToJSON)),
'net_d': value['netD'],
'new_period_end': value['newPeriodEnd'] == null ? undefined : (value['newPeriodEnd'].toISOString()),
'payment_method_id': value['paymentMethodId'],
'preview_renewal_invoices': value['previewRenewalInvoices'],
'promotion_code': value['promotionCode'],
'proration_behavior': (0, ProrationEnum_1.ProrationEnumToJSON)(value['prorationBehavior']),
'trial_end': value['trialEnd'] == null ? undefined : (value['trialEnd'].toISOString()),
'trial_period_days': value['trialPeriodDays'],
};
}