UNPKG

square-connect

Version:

JavaScript client library for the Square Connect v2 API

194 lines (163 loc) 7.01 kB
/** * 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 Subscription model module. * Note: This model is in beta. * @module model/Subscription */ /** * Constructs a new <code>Subscription</code>. * Represents a customer subscription to a subscription plan. For an overview of the &#x60;Subscription&#x60; type, see [Subscription object](/docs/subscriptions-api/overview#subscription-object-overview). * @alias module:model/Subscription * @class */ var exports = function() { var _this = this; }; /** * Constructs a <code>Subscription</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/Subscription} obj Optional instance to populate. * @return {module:model/Subscription} The populated <code>Subscription</code> instance. */ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'String'); } if (data.hasOwnProperty('location_id')) { obj['location_id'] = ApiClient.convertToType(data['location_id'], 'String'); } if (data.hasOwnProperty('plan_id')) { obj['plan_id'] = ApiClient.convertToType(data['plan_id'], 'String'); } if (data.hasOwnProperty('customer_id')) { obj['customer_id'] = ApiClient.convertToType(data['customer_id'], 'String'); } if (data.hasOwnProperty('start_date')) { obj['start_date'] = ApiClient.convertToType(data['start_date'], 'String'); } if (data.hasOwnProperty('canceled_date')) { obj['canceled_date'] = ApiClient.convertToType(data['canceled_date'], 'String'); } if (data.hasOwnProperty('status')) { obj['status'] = ApiClient.convertToType(data['status'], 'String'); } if (data.hasOwnProperty('tax_percentage')) { obj['tax_percentage'] = ApiClient.convertToType(data['tax_percentage'], 'String'); } if (data.hasOwnProperty('invoice_ids')) { obj['invoice_ids'] = ApiClient.convertToType(data['invoice_ids'], ['String']); } if (data.hasOwnProperty('price_override_money')) { obj['price_override_money'] = Money.constructFromObject(data['price_override_money']); } if (data.hasOwnProperty('version')) { obj['version'] = ApiClient.convertToType(data['version'], 'Number'); } if (data.hasOwnProperty('created_at')) { obj['created_at'] = ApiClient.convertToType(data['created_at'], 'String'); } if (data.hasOwnProperty('card_id')) { obj['card_id'] = ApiClient.convertToType(data['card_id'], 'String'); } if (data.hasOwnProperty('paid_until_date')) { obj['paid_until_date'] = ApiClient.convertToType(data['paid_until_date'], 'String'); } if (data.hasOwnProperty('timezone')) { obj['timezone'] = ApiClient.convertToType(data['timezone'], 'String'); } } return obj; } /** * The Square-assigned ID of the subscription. * @member {String} id */ exports.prototype['id'] = undefined; /** * The ID of the location associated with the subscription. * @member {String} location_id */ exports.prototype['location_id'] = undefined; /** * The ID of the associated `subscription plan`. * @member {String} plan_id */ exports.prototype['plan_id'] = undefined; /** * The ID of the associated `customer` profile. * @member {String} customer_id */ exports.prototype['customer_id'] = undefined; /** * The start date of the subscription, in YYYY-MM-DD format (for example, 2013-01-15). * @member {String} start_date */ exports.prototype['start_date'] = undefined; /** * The subscription cancellation date, in YYYY-MM-DD format (for example, 2013-01-15). On this date, the subscription status changes to `CANCELED` and the subscription billing stops. If you don't set this field, the subscription plan dictates if and when subscription ends. You cannot update this field, you can only clear it. * @member {String} canceled_date */ exports.prototype['canceled_date'] = undefined; /** * The current status of the subscription. See [SubscriptionStatus](#type-subscriptionstatus) for possible values * @member {String} status */ exports.prototype['status'] = undefined; /** * The tax amount applied when billing the subscription. The percentage is expressed in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign. For example, a value of `7.5` corresponds to 7.5%. * @member {String} tax_percentage */ exports.prototype['tax_percentage'] = undefined; /** * The IDs of the `invoices` created for the subscription, listed in order when the invoices were created (oldest invoices appear first). * @member {Array.<String>} invoice_ids */ exports.prototype['invoice_ids'] = undefined; /** * A custom price to apply for the subscription. If specified, it overrides the price configured by the subscription plan. * @member {module:model/Money} price_override_money */ exports.prototype['price_override_money'] = undefined; /** * The version of the object. When updating an object, the version supplied must match the version in the database, otherwise the write will be rejected as conflicting. * @member {Number} version */ exports.prototype['version'] = undefined; /** * The timestamp when the subscription was created, in RFC 3339 format. * @member {String} created_at */ exports.prototype['created_at'] = undefined; /** * The ID of the `customer](#type-customer) [card` that is charged for the subscription. * @member {String} card_id */ exports.prototype['card_id'] = undefined; /** * The date up to which the customer is invoiced for the subscription, in YYYY-MM-DD format (for example, 2013-01-15). After the invoice is paid for a given billing period, this date will be the last day of the billing period. For example, suppose for the month of May a customer gets an invoice (or charged the card) on May 1. For the monthly billing scenario, this date is then set to May 31. * @member {String} paid_until_date */ exports.prototype['paid_until_date'] = undefined; /** * Timezone that will be used in date calculations for the subscription. Defaults to the timezone of the location based on `location_id`. Format: the IANA Timezone Database identifier for the location timezone (for example, `America/Los_Angeles`). * @member {String} timezone */ exports.prototype['timezone'] = undefined; module.exports = exports;