square-connect
Version:
JavaScript client library for the Square Connect v2 API
160 lines (135 loc) • 5.55 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 DeviceCheckoutOptions = require('./DeviceCheckoutOptions');
var Money = require('./Money');
/**
* The TerminalCheckout model module.
* @module model/TerminalCheckout
*/
/**
* Constructs a new <code>TerminalCheckout</code>.
*
* @alias module:model/TerminalCheckout
* @class
* @param amountMoney {module:model/Money} The amount of money (including tax amount) that the Square Terminal device should try to collect.
* @param deviceOptions {module:model/DeviceCheckoutOptions} Options to control the display and behavior of the Square Terminal device.
*/
var exports = function(amountMoney, deviceOptions) {
var _this = this;
_this['amount_money'] = amountMoney;
_this['device_options'] = deviceOptions;
};
/**
* Constructs a <code>TerminalCheckout</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/TerminalCheckout} obj Optional instance to populate.
* @return {module:model/TerminalCheckout} The populated <code>TerminalCheckout</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('amount_money')) {
obj['amount_money'] = Money.constructFromObject(data['amount_money']);
}
if (data.hasOwnProperty('reference_id')) {
obj['reference_id'] = ApiClient.convertToType(data['reference_id'], 'String');
}
if (data.hasOwnProperty('note')) {
obj['note'] = ApiClient.convertToType(data['note'], 'String');
}
if (data.hasOwnProperty('device_options')) {
obj['device_options'] = DeviceCheckoutOptions.constructFromObject(data['device_options']);
}
if (data.hasOwnProperty('deadline_duration')) {
obj['deadline_duration'] = ApiClient.convertToType(data['deadline_duration'], 'String');
}
if (data.hasOwnProperty('status')) {
obj['status'] = ApiClient.convertToType(data['status'], 'String');
}
if (data.hasOwnProperty('cancel_reason')) {
obj['cancel_reason'] = ApiClient.convertToType(data['cancel_reason'], 'String');
}
if (data.hasOwnProperty('payment_ids')) {
obj['payment_ids'] = ApiClient.convertToType(data['payment_ids'], ['String']);
}
if (data.hasOwnProperty('created_at')) {
obj['created_at'] = ApiClient.convertToType(data['created_at'], 'String');
}
if (data.hasOwnProperty('updated_at')) {
obj['updated_at'] = ApiClient.convertToType(data['updated_at'], 'String');
}
}
return obj;
}
/**
* A unique ID for this `TerminalCheckout`
* @member {String} id
*/
exports.prototype['id'] = undefined;
/**
* The amount of money (including tax amount) that the Square Terminal device should try to collect.
* @member {module:model/Money} amount_money
*/
exports.prototype['amount_money'] = undefined;
/**
* An optional user-defined reference ID which can be used to associate this `TerminalCheckout` to another entity in an external system. For example, an order ID generated by a third-party shopping cart. Will also be associated with any payments used to complete the checkout.
* @member {String} reference_id
*/
exports.prototype['reference_id'] = undefined;
/**
* An optional note to associate with the checkout, as well any payments used to complete the checkout.
* @member {String} note
*/
exports.prototype['note'] = undefined;
/**
* Options to control the display and behavior of the Square Terminal device.
* @member {module:model/DeviceCheckoutOptions} device_options
*/
exports.prototype['device_options'] = undefined;
/**
* The duration as an RFC 3339 duration, after which the checkout will be automatically canceled. TerminalCheckouts that are `PENDING` will be automatically `CANCELED` and have a cancellation reason of `TIMED_OUT`. Default: 5 minutes from creation Maximum: 5 minutes
* @member {String} deadline_duration
*/
exports.prototype['deadline_duration'] = undefined;
/**
* The status of the `TerminalCheckout`. Options: `PENDING`, `IN_PROGRESS`, `CANCEL_REQUESTED`, `CANCELED`, `COMPLETED`
* @member {String} status
*/
exports.prototype['status'] = undefined;
/**
* Present if the status is `CANCELED`. See [ActionCancelReason](#type-actioncancelreason) for possible values
* @member {String} cancel_reason
*/
exports.prototype['cancel_reason'] = undefined;
/**
* A list of ids for payments created by this `TerminalCheckout`.
* @member {Array.<String>} payment_ids
*/
exports.prototype['payment_ids'] = undefined;
/**
* The time when the `TerminalCheckout` was created as an RFC 3339 timestamp.
* @member {String} created_at
*/
exports.prototype['created_at'] = undefined;
/**
* The time when the `TerminalCheckout` was last updated as an RFC 3339 timestamp.
* @member {String} updated_at
*/
exports.prototype['updated_at'] = undefined;
module.exports = exports;