square-connect
Version:
JavaScript client library for the Square Connect v2 API
160 lines (135 loc) • 5.43 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');
var ProcessingFee = require('./ProcessingFee');
/**
* The PaymentRefund model module.
* @module model/PaymentRefund
*/
/**
* Constructs a new <code>PaymentRefund</code>.
* Represents a refund of a payment made using Square. Contains information about the original payment and the amount of money refunded.
* @alias module:model/PaymentRefund
* @class
* @param id {String} The unique ID for this refund, generated by Square.
* @param amountMoney {module:model/Money} The amount of money refunded. This amount is specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents).
*/
var exports = function(id, amountMoney) {
var _this = this;
_this['id'] = id;
_this['amount_money'] = amountMoney;
};
/**
* Constructs a <code>PaymentRefund</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/PaymentRefund} obj Optional instance to populate.
* @return {module:model/PaymentRefund} The populated <code>PaymentRefund</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('status')) {
obj['status'] = ApiClient.convertToType(data['status'], 'String');
}
if (data.hasOwnProperty('location_id')) {
obj['location_id'] = ApiClient.convertToType(data['location_id'], 'String');
}
if (data.hasOwnProperty('amount_money')) {
obj['amount_money'] = Money.constructFromObject(data['amount_money']);
}
if (data.hasOwnProperty('app_fee_money')) {
obj['app_fee_money'] = Money.constructFromObject(data['app_fee_money']);
}
if (data.hasOwnProperty('processing_fee')) {
obj['processing_fee'] = ApiClient.convertToType(data['processing_fee'], [ProcessingFee]);
}
if (data.hasOwnProperty('payment_id')) {
obj['payment_id'] = ApiClient.convertToType(data['payment_id'], 'String');
}
if (data.hasOwnProperty('order_id')) {
obj['order_id'] = ApiClient.convertToType(data['order_id'], 'String');
}
if (data.hasOwnProperty('reason')) {
obj['reason'] = ApiClient.convertToType(data['reason'], '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;
}
/**
* The unique ID for this refund, generated by Square.
* @member {String} id
*/
exports.prototype['id'] = undefined;
/**
* The refund's status: - `PENDING` - Awaiting approval. - `COMPLETED` - Successfully completed. - `REJECTED` - The refund was rejected. - `FAILED` - An error occurred.
* @member {String} status
*/
exports.prototype['status'] = undefined;
/**
* The location ID associated with the payment this refund is attached to.
* @member {String} location_id
*/
exports.prototype['location_id'] = undefined;
/**
* The amount of money refunded. This amount is specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents).
* @member {module:model/Money} amount_money
*/
exports.prototype['amount_money'] = undefined;
/**
* The amount of money the application developer contributed to help cover the refunded amount. This amount is specified in the smallest denomination of the applicable currency (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
* @member {module:model/Money} app_fee_money
*/
exports.prototype['app_fee_money'] = undefined;
/**
* Processing fees and fee adjustments assessed by Square for this refund.
* @member {Array.<module:model/ProcessingFee>} processing_fee
*/
exports.prototype['processing_fee'] = undefined;
/**
* The ID of the payment assocated with this refund.
* @member {String} payment_id
*/
exports.prototype['payment_id'] = undefined;
/**
* The ID of the order associated with the refund.
* @member {String} order_id
*/
exports.prototype['order_id'] = undefined;
/**
* The reason for the refund.
* @member {String} reason
*/
exports.prototype['reason'] = undefined;
/**
* The timestamp of when the refund was created, in RFC 3339 format.
* @member {String} created_at
*/
exports.prototype['created_at'] = undefined;
/**
* The timestamp of when the refund was last updated, in RFC 3339 format.
* @member {String} updated_at
*/
exports.prototype['updated_at'] = undefined;
module.exports = exports;