@getopenpay/client
Version:
OpenPay API TypeScript SDK
106 lines (105 loc) • 4.52 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.instanceOfDiscountExternal = instanceOfDiscountExternal;
exports.DiscountExternalFromJSON = DiscountExternalFromJSON;
exports.DiscountExternalFromJSONTyped = DiscountExternalFromJSONTyped;
exports.DiscountExternalToJSON = DiscountExternalToJSON;
exports.DiscountExternalToJSONTyped = DiscountExternalToJSONTyped;
const PromotionCodeExternal_1 = require("./PromotionCodeExternal");
const CouponExternal_1 = require("./CouponExternal");
const ObjectName_1 = require("./ObjectName");
/**
* Check if a given object implements the DiscountExternal interface.
*/
function instanceOfDiscountExternal(value) {
if (!('coupon' in value) || value['coupon'] === undefined)
return false;
if (!('couponId' in value) || value['couponId'] === undefined)
return false;
if (!('createdAt' in value) || value['createdAt'] === undefined)
return false;
if (!('customerId' in value) || value['customerId'] === undefined)
return false;
if (!('endDate' in value) || value['endDate'] === undefined)
return false;
if (!('id' in value) || value['id'] === undefined)
return false;
if (!('invoiceId' in value) || value['invoiceId'] === undefined)
return false;
if (!('invoiceItemId' in value) || value['invoiceItemId'] === undefined)
return false;
if (!('promotionCode' in value) || value['promotionCode'] === undefined)
return false;
if (!('promotionCodeId' in value) || value['promotionCodeId'] === undefined)
return false;
if (!('startDate' in value) || value['startDate'] === undefined)
return false;
if (!('subscriptionId' in value) || value['subscriptionId'] === undefined)
return false;
if (!('updatedAt' in value) || value['updatedAt'] === undefined)
return false;
return true;
}
function DiscountExternalFromJSON(json) {
return DiscountExternalFromJSONTyped(json, false);
}
function DiscountExternalFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'coupon': (0, CouponExternal_1.CouponExternalFromJSON)(json['coupon']),
'couponId': json['coupon_id'],
'createdAt': (new Date(json['created_at'])),
'customerId': json['customer_id'],
'endDate': (json['end_date'] == null ? null : new Date(json['end_date'])),
'id': json['id'],
'invoiceId': json['invoice_id'],
'invoiceItemId': json['invoice_item_id'],
'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'],
'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']),
'promotionCode': (0, PromotionCodeExternal_1.PromotionCodeExternalFromJSON)(json['promotion_code']),
'promotionCodeId': json['promotion_code_id'],
'startDate': (new Date(json['start_date'])),
'subscriptionId': json['subscription_id'],
'updatedAt': (new Date(json['updated_at'])),
};
}
function DiscountExternalToJSON(json) {
return DiscountExternalToJSONTyped(json, false);
}
function DiscountExternalToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'coupon': (0, CouponExternal_1.CouponExternalToJSON)(value['coupon']),
'coupon_id': value['couponId'],
'created_at': ((value['createdAt']).toISOString()),
'customer_id': value['customerId'],
'end_date': (value['endDate'] == null ? null : value['endDate'].toISOString()),
'id': value['id'],
'invoice_id': value['invoiceId'],
'invoice_item_id': value['invoiceItemId'],
'is_deleted': value['isDeleted'],
'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']),
'promotion_code': (0, PromotionCodeExternal_1.PromotionCodeExternalToJSON)(value['promotionCode']),
'promotion_code_id': value['promotionCodeId'],
'start_date': ((value['startDate']).toISOString()),
'subscription_id': value['subscriptionId'],
'updated_at': ((value['updatedAt']).toISOString()),
};
}