square-connect
Version:
JavaScript client library for the Square Connect v2 API
222 lines (188 loc) • 7.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 V1Money = require('./V1Money');
var V1PaymentSurcharge = require('./V1PaymentSurcharge');
var V1PaymentTax = require('./V1PaymentTax');
/**
* The V1Refund model module.
* @module model/V1Refund
*/
/**
* Constructs a new <code>V1Refund</code>.
* V1Refund
* @alias module:model/V1Refund
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>V1Refund</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/V1Refund} obj Optional instance to populate.
* @return {module:model/V1Refund} The populated <code>V1Refund</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('type')) {
obj['type'] = ApiClient.convertToType(data['type'], 'String');
}
if (data.hasOwnProperty('reason')) {
obj['reason'] = ApiClient.convertToType(data['reason'], 'String');
}
if (data.hasOwnProperty('refunded_money')) {
obj['refunded_money'] = V1Money.constructFromObject(data['refunded_money']);
}
if (data.hasOwnProperty('refunded_processing_fee_money')) {
obj['refunded_processing_fee_money'] = V1Money.constructFromObject(data['refunded_processing_fee_money']);
}
if (data.hasOwnProperty('refunded_tax_money')) {
obj['refunded_tax_money'] = V1Money.constructFromObject(data['refunded_tax_money']);
}
if (data.hasOwnProperty('refunded_additive_tax_money')) {
obj['refunded_additive_tax_money'] = V1Money.constructFromObject(data['refunded_additive_tax_money']);
}
if (data.hasOwnProperty('refunded_additive_tax')) {
obj['refunded_additive_tax'] = ApiClient.convertToType(data['refunded_additive_tax'], [V1PaymentTax]);
}
if (data.hasOwnProperty('refunded_inclusive_tax_money')) {
obj['refunded_inclusive_tax_money'] = V1Money.constructFromObject(data['refunded_inclusive_tax_money']);
}
if (data.hasOwnProperty('refunded_inclusive_tax')) {
obj['refunded_inclusive_tax'] = ApiClient.convertToType(data['refunded_inclusive_tax'], [V1PaymentTax]);
}
if (data.hasOwnProperty('refunded_tip_money')) {
obj['refunded_tip_money'] = V1Money.constructFromObject(data['refunded_tip_money']);
}
if (data.hasOwnProperty('refunded_discount_money')) {
obj['refunded_discount_money'] = V1Money.constructFromObject(data['refunded_discount_money']);
}
if (data.hasOwnProperty('refunded_surcharge_money')) {
obj['refunded_surcharge_money'] = V1Money.constructFromObject(data['refunded_surcharge_money']);
}
if (data.hasOwnProperty('refunded_surcharges')) {
obj['refunded_surcharges'] = ApiClient.convertToType(data['refunded_surcharges'], [V1PaymentSurcharge]);
}
if (data.hasOwnProperty('created_at')) {
obj['created_at'] = ApiClient.convertToType(data['created_at'], 'String');
}
if (data.hasOwnProperty('processed_at')) {
obj['processed_at'] = ApiClient.convertToType(data['processed_at'], 'String');
}
if (data.hasOwnProperty('payment_id')) {
obj['payment_id'] = ApiClient.convertToType(data['payment_id'], 'String');
}
if (data.hasOwnProperty('merchant_id')) {
obj['merchant_id'] = ApiClient.convertToType(data['merchant_id'], 'String');
}
if (data.hasOwnProperty('is_exchange')) {
obj['is_exchange'] = ApiClient.convertToType(data['is_exchange'], 'Boolean');
}
}
return obj;
}
/**
* The type of refund See [V1RefundType](#type-v1refundtype) for possible values
* @member {String} type
*/
exports.prototype['type'] = undefined;
/**
* The merchant-specified reason for the refund.
* @member {String} reason
*/
exports.prototype['reason'] = undefined;
/**
* The amount of money refunded. This amount is always negative.
* @member {module:model/V1Money} refunded_money
*/
exports.prototype['refunded_money'] = undefined;
/**
* The amount of processing fee money refunded. This amount is always positive.
* @member {module:model/V1Money} refunded_processing_fee_money
*/
exports.prototype['refunded_processing_fee_money'] = undefined;
/**
* The total amount of tax money refunded. This amount is always negative.
* @member {module:model/V1Money} refunded_tax_money
*/
exports.prototype['refunded_tax_money'] = undefined;
/**
* The amount of additive tax money refunded. This amount is always negative.
* @member {module:model/V1Money} refunded_additive_tax_money
*/
exports.prototype['refunded_additive_tax_money'] = undefined;
/**
* All of the additive taxes associated with the refund.
* @member {Array.<module:model/V1PaymentTax>} refunded_additive_tax
*/
exports.prototype['refunded_additive_tax'] = undefined;
/**
* The amount of inclusive tax money refunded. This amount is always negative.
* @member {module:model/V1Money} refunded_inclusive_tax_money
*/
exports.prototype['refunded_inclusive_tax_money'] = undefined;
/**
* All of the inclusive taxes associated with the refund.
* @member {Array.<module:model/V1PaymentTax>} refunded_inclusive_tax
*/
exports.prototype['refunded_inclusive_tax'] = undefined;
/**
* The amount of tip money refunded. This amount is always negative.
* @member {module:model/V1Money} refunded_tip_money
*/
exports.prototype['refunded_tip_money'] = undefined;
/**
* The amount of discount money refunded. This amount is always positive.
* @member {module:model/V1Money} refunded_discount_money
*/
exports.prototype['refunded_discount_money'] = undefined;
/**
* The amount of surcharge money refunded. This amount is always negative.
* @member {module:model/V1Money} refunded_surcharge_money
*/
exports.prototype['refunded_surcharge_money'] = undefined;
/**
* A list of all surcharges associated with the refund.
* @member {Array.<module:model/V1PaymentSurcharge>} refunded_surcharges
*/
exports.prototype['refunded_surcharges'] = undefined;
/**
* The time when the merchant initiated the refund for Square to process, in ISO 8601 format.
* @member {String} created_at
*/
exports.prototype['created_at'] = undefined;
/**
* The time when Square processed the refund on behalf of the merchant, in ISO 8601 format.
* @member {String} processed_at
*/
exports.prototype['processed_at'] = undefined;
/**
* A Square-issued ID associated with the refund. For single-tender refunds, payment_id is the ID of the original payment ID. For split-tender refunds, payment_id is the ID of the original tender. For exchange-based refunds (is_exchange == true), payment_id is the ID of the original payment ID even if the payment includes other tenders.
* @member {String} payment_id
*/
exports.prototype['payment_id'] = undefined;
/**
*
* @member {String} merchant_id
*/
exports.prototype['merchant_id'] = undefined;
/**
* Indicates whether or not the refund is associated with an exchange. If is_exchange is true, the refund reflects the value of goods returned in the exchange not the total money refunded.
* @member {Boolean} is_exchange
*/
exports.prototype['is_exchange'] = undefined;
module.exports = exports;