square-connect
Version:
JavaScript client library for the Square Connect v2 API
186 lines (156 loc) • 5.63 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 DisputedPayment = require('./DisputedPayment');
var Money = require('./Money');
/**
* The Dispute model module.
* Note: This model is in beta.
* @module model/Dispute
*/
/**
* Constructs a new <code>Dispute</code>.
* Represents a dispute a cardholder initiated with their bank.
* @alias module:model/Dispute
* @class
*/
var exports = function() {
var _this = this;
};
/**
* Constructs a <code>Dispute</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/Dispute} obj Optional instance to populate.
* @return {module:model/Dispute} The populated <code>Dispute</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('dispute_id')) {
obj['dispute_id'] = ApiClient.convertToType(data['dispute_id'], 'String');
}
if (data.hasOwnProperty('amount_money')) {
obj['amount_money'] = Money.constructFromObject(data['amount_money']);
}
if (data.hasOwnProperty('reason')) {
obj['reason'] = ApiClient.convertToType(data['reason'], 'String');
}
if (data.hasOwnProperty('state')) {
obj['state'] = ApiClient.convertToType(data['state'], 'String');
}
if (data.hasOwnProperty('due_at')) {
obj['due_at'] = ApiClient.convertToType(data['due_at'], 'String');
}
if (data.hasOwnProperty('disputed_payment')) {
obj['disputed_payment'] = DisputedPayment.constructFromObject(data['disputed_payment']);
}
if (data.hasOwnProperty('evidence_ids')) {
obj['evidence_ids'] = ApiClient.convertToType(data['evidence_ids'], ['String']);
}
if (data.hasOwnProperty('card_brand')) {
obj['card_brand'] = ApiClient.convertToType(data['card_brand'], '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');
}
if (data.hasOwnProperty('brand_dispute_id')) {
obj['brand_dispute_id'] = ApiClient.convertToType(data['brand_dispute_id'], 'String');
}
if (data.hasOwnProperty('reported_date')) {
obj['reported_date'] = ApiClient.convertToType(data['reported_date'], 'String');
}
if (data.hasOwnProperty('version')) {
obj['version'] = ApiClient.convertToType(data['version'], 'Number');
}
if (data.hasOwnProperty('location_id')) {
obj['location_id'] = ApiClient.convertToType(data['location_id'], 'String');
}
}
return obj;
}
/**
* The unique ID for this `Dispute`, generated by Square.
* @member {String} dispute_id
*/
exports.prototype['dispute_id'] = undefined;
/**
* The disputed amount. The amount can be less than the entire transaction amount. For example, a cardholder purchased multiple items, however initiated dispute only for some of the items.
* @member {module:model/Money} amount_money
*/
exports.prototype['amount_money'] = undefined;
/**
* The dispute reason why the cardholder initiated the dispute with their bank. See [DisputeReason](#type-disputereason) for possible values
* @member {String} reason
*/
exports.prototype['reason'] = undefined;
/**
* The current state of this dispute. See [DisputeState](#type-disputestate) for possible values
* @member {String} state
*/
exports.prototype['state'] = undefined;
/**
* The time when the next action is due, in RFC 3339 format.
* @member {String} due_at
*/
exports.prototype['due_at'] = undefined;
/**
* The payment challenged in this dispute.
* @member {module:model/DisputedPayment} disputed_payment
*/
exports.prototype['disputed_payment'] = undefined;
/**
* The IDs of the evidence associated with the dispute.
* @member {Array.<String>} evidence_ids
*/
exports.prototype['evidence_ids'] = undefined;
/**
* The card brand used in the disputed payment. See [CardBrand](#type-cardbrand) for possible values
* @member {String} card_brand
*/
exports.prototype['card_brand'] = undefined;
/**
* The timestamp when the dispute was created, in RFC 3339 format.
* @member {String} created_at
*/
exports.prototype['created_at'] = undefined;
/**
* The timestamp when the dispute was last updated, in RFC 3339 format.
* @member {String} updated_at
*/
exports.prototype['updated_at'] = undefined;
/**
* The ID of the dispute in the card brand system, generated by the card brand.
* @member {String} brand_dispute_id
*/
exports.prototype['brand_dispute_id'] = undefined;
/**
* The timestamp when the dispute was reported, in RFC 3339 format.
* @member {String} reported_date
*/
exports.prototype['reported_date'] = undefined;
/**
* The current version of the `Dispute`.
* @member {Number} version
*/
exports.prototype['version'] = undefined;
/**
* The ID of the location where the dispute originated.
* @member {String} location_id
*/
exports.prototype['location_id'] = undefined;
module.exports = exports;