square-connect
Version:
JavaScript client library for the Square Connect v2 API
131 lines (107 loc) • 4.27 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 OrderReturnTax model module.
* Note: This model is in beta.
* @module model/OrderReturnTax
*/
/**
* Constructs a new <code>OrderReturnTax</code>.
* Represents a tax being returned that applies to one or more return line items in an order. Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals. The amount distributed to each return line item is relative to that item’s contribution to the order subtotal.
* @alias module:model/OrderReturnTax
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>OrderReturnTax</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/OrderReturnTax} obj Optional instance to populate.
* @return {module:model/OrderReturnTax} The populated <code>OrderReturnTax</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('source_tax_uid')) {
obj['source_tax_uid'] = ApiClient.convertToType(data['source_tax_uid'], 'String');
}
if (data.hasOwnProperty('catalog_object_id')) {
obj['catalog_object_id'] = ApiClient.convertToType(data['catalog_object_id'], 'String');
}
if (data.hasOwnProperty('name')) {
obj['name'] = ApiClient.convertToType(data['name'], 'String');
}
if (data.hasOwnProperty('type')) {
obj['type'] = ApiClient.convertToType(data['type'], 'String');
}
if (data.hasOwnProperty('percentage')) {
obj['percentage'] = ApiClient.convertToType(data['percentage'], 'String');
}
if (data.hasOwnProperty('applied_money')) {
obj['applied_money'] = Money.constructFromObject(data['applied_money']);
}
if (data.hasOwnProperty('scope')) {
obj['scope'] = ApiClient.convertToType(data['scope'], 'String');
}
}
return obj;
}
/**
* Unique ID that identifies the return tax only within this order.
* @member {String} uid
*/
exports.prototype['uid'] = undefined;
/**
* `uid` of the Tax from the Order which contains the original charge of this tax.
* @member {String} source_tax_uid
*/
exports.prototype['source_tax_uid'] = undefined;
/**
* The catalog object id referencing `CatalogTax`.
* @member {String} catalog_object_id
*/
exports.prototype['catalog_object_id'] = undefined;
/**
* The tax's name.
* @member {String} name
*/
exports.prototype['name'] = undefined;
/**
* Indicates the calculation method used to apply the tax. See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
* @member {String} type
*/
exports.prototype['type'] = undefined;
/**
* The percentage of the tax, as a string representation of a decimal number. For example, a value of `\"7.25\"` corresponds to a percentage of 7.25%.
* @member {String} percentage
*/
exports.prototype['percentage'] = undefined;
/**
* The amount of the money applied by the tax in an order.
* @member {module:model/Money} applied_money
*/
exports.prototype['applied_money'] = undefined;
/**
* Indicates the level at which the `OrderReturnTax` applies. For `ORDER` scoped taxes, Square generates references in `applied_taxes` on all `OrderReturnLineItem`s. For `LINE_ITEM` scoped taxes, the tax will only apply to `OrderReturnLineItem`s with references in their `applied_discounts` field. See [OrderLineItemTaxScope](#type-orderlineitemtaxscope) for possible values
* @member {String} scope
*/
exports.prototype['scope'] = undefined;
module.exports = exports;