square-connect
Version:
JavaScript client library for the Square Connect v2 API
142 lines (119 loc) • 4.85 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 LoyaltyAccountMapping = require('./LoyaltyAccountMapping');
/**
* The LoyaltyAccount model module.
* Note: This model is in beta.
* @module model/LoyaltyAccount
*/
/**
* Constructs a new <code>LoyaltyAccount</code>.
* Describes a loyalty account. For more information, see [Loyalty Overview](/docs/loyalty/overview).
* @alias module:model/LoyaltyAccount
* @class
* @param mappings {Array.<module:model/LoyaltyAccountMapping>} The list of mappings that the account is associated with. Currently, a buyer can only be mapped to a loyalty account using a phone number. Therefore, the list can only have one mapping.
* @param programId {String} The Square-assigned ID of the `loyalty program` to which the account belongs.
*/
var exports = function(mappings, programId) {
var _this = this;
_this['mappings'] = mappings;
_this['program_id'] = programId;
};
/**
* Constructs a <code>LoyaltyAccount</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/LoyaltyAccount} obj Optional instance to populate.
* @return {module:model/LoyaltyAccount} The populated <code>LoyaltyAccount</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('mappings')) {
obj['mappings'] = ApiClient.convertToType(data['mappings'], [LoyaltyAccountMapping]);
}
if (data.hasOwnProperty('program_id')) {
obj['program_id'] = ApiClient.convertToType(data['program_id'], 'String');
}
if (data.hasOwnProperty('balance')) {
obj['balance'] = ApiClient.convertToType(data['balance'], 'Number');
}
if (data.hasOwnProperty('lifetime_points')) {
obj['lifetime_points'] = ApiClient.convertToType(data['lifetime_points'], 'Number');
}
if (data.hasOwnProperty('customer_id')) {
obj['customer_id'] = ApiClient.convertToType(data['customer_id'], 'String');
}
if (data.hasOwnProperty('enrolled_at')) {
obj['enrolled_at'] = ApiClient.convertToType(data['enrolled_at'], '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 Square-assigned ID of the loyalty account.
* @member {String} id
*/
exports.prototype['id'] = undefined;
/**
* The list of mappings that the account is associated with. Currently, a buyer can only be mapped to a loyalty account using a phone number. Therefore, the list can only have one mapping.
* @member {Array.<module:model/LoyaltyAccountMapping>} mappings
*/
exports.prototype['mappings'] = undefined;
/**
* The Square-assigned ID of the `loyalty program` to which the account belongs.
* @member {String} program_id
*/
exports.prototype['program_id'] = undefined;
/**
* The available point balance in the loyalty account. Your application should be able to handle loyalty accounts that have a negative point balance (`balance` is less than 0). This might occur if a seller makes a manual adjustment or as a result of a refund or exchange.
* @member {Number} balance
*/
exports.prototype['balance'] = undefined;
/**
* The total points accrued during the lifetime of the account.
* @member {Number} lifetime_points
*/
exports.prototype['lifetime_points'] = undefined;
/**
* The Square-assigned ID of the `customer` that is associated with the account.
* @member {String} customer_id
*/
exports.prototype['customer_id'] = undefined;
/**
* The timestamp when enrollment occurred, in RFC 3339 format.
* @member {String} enrolled_at
*/
exports.prototype['enrolled_at'] = undefined;
/**
* The timestamp when the loyalty account was created, in RFC 3339 format.
* @member {String} created_at
*/
exports.prototype['created_at'] = undefined;
/**
* The timestamp when the loyalty account was last updated, in RFC 3339 format.
* @member {String} updated_at
*/
exports.prototype['updated_at'] = undefined;
module.exports = exports;