square-connect
Version:
JavaScript client library for the Square Connect v2 API
106 lines (87 loc) • 3.73 kB
JavaScript
/**
* Square Connect API
* Client library for accessing the Square Connect APIs
*
* OpenAPI spec version: 2.0
* Contact: developers@squareup.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.3.0-SNAPSHOT
*
*/
var ApiClient = require('../ApiClient');
var Money = require('./Money');
/**
* The SubscriptionPhase model module.
* Note: This model is in beta.
* @module model/SubscriptionPhase
*/
/**
* Constructs a new <code>SubscriptionPhase</code>.
* Describes a phase in a subscription plan. For more information, see [Set Up and Manage a Subscription Plan](/docs/subscriptions-api/setup-plan).
* @alias module:model/SubscriptionPhase
* @class
* @param cadence {String} The billing cadence of the phase. For example, weekly or monthly. This field cannot be changed after a `SubscriptionPhase` is created. See [SubscriptionCadence](#type-subscriptioncadence) for possible values
* @param recurringPriceMoney {module:model/Money} The amount to bill for each `cadence`.
*/
var exports = function(cadence, recurringPriceMoney) {
var _this = this;
_this['cadence'] = cadence;
_this['recurring_price_money'] = recurringPriceMoney;
};
/**
* Constructs a <code>SubscriptionPhase</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/SubscriptionPhase} obj Optional instance to populate.
* @return {module:model/SubscriptionPhase} The populated <code>SubscriptionPhase</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('uid')) {
obj['uid'] = ApiClient.convertToType(data['uid'], 'String');
}
if (data.hasOwnProperty('cadence')) {
obj['cadence'] = ApiClient.convertToType(data['cadence'], 'String');
}
if (data.hasOwnProperty('periods')) {
obj['periods'] = ApiClient.convertToType(data['periods'], 'Number');
}
if (data.hasOwnProperty('recurring_price_money')) {
obj['recurring_price_money'] = Money.constructFromObject(data['recurring_price_money']);
}
if (data.hasOwnProperty('ordinal')) {
obj['ordinal'] = ApiClient.convertToType(data['ordinal'], 'Number');
}
}
return obj;
}
/**
* The Square-assigned ID of the subscription phase. This field cannot be changed after a `SubscriptionPhase` is created.
* @member {String} uid
*/
exports.prototype['uid'] = undefined;
/**
* The billing cadence of the phase. For example, weekly or monthly. This field cannot be changed after a `SubscriptionPhase` is created. See [SubscriptionCadence](#type-subscriptioncadence) for possible values
* @member {String} cadence
*/
exports.prototype['cadence'] = undefined;
/**
* The number of `cadence`s the phase lasts. If not set, the phase never ends. Only the last phase can be indefinite. This field cannot be changed after a `SubscriptionPhase` is created.
* @member {Number} periods
*/
exports.prototype['periods'] = undefined;
/**
* The amount to bill for each `cadence`.
* @member {module:model/Money} recurring_price_money
*/
exports.prototype['recurring_price_money'] = undefined;
/**
* The position this phase appears in the sequence of phases defined for the plan, indexed from 0. This field cannot be changed after a `SubscriptionPhase` is created.
* @member {Number} ordinal
*/
exports.prototype['ordinal'] = undefined;
module.exports = exports;