UNPKG

square-connect

Version:

JavaScript client library for the Square Connect v2 API

105 lines (85 loc) 3.93 kB
/** * 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 LoyaltyProgramAccrualRule model module. * Note: This model is in beta. * @module model/LoyaltyProgramAccrualRule */ /** * Constructs a new <code>LoyaltyProgramAccrualRule</code>. * Defines an accrual rule, which is how buyers can earn points. * @alias module:model/LoyaltyProgramAccrualRule * @class * @param accrualType {String} The type of the accrual rule that defines how buyers can earn points. See [LoyaltyProgramAccrualRuleType](#type-loyaltyprogramaccrualruletype) for possible values */ var exports = function(accrualType) { var _this = this; _this['accrual_type'] = accrualType; }; /** * Constructs a <code>LoyaltyProgramAccrualRule</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/LoyaltyProgramAccrualRule} obj Optional instance to populate. * @return {module:model/LoyaltyProgramAccrualRule} The populated <code>LoyaltyProgramAccrualRule</code> instance. */ exports.constructFromObject = function(data, obj) { if (data) { obj = obj || new exports(); if (data.hasOwnProperty('accrual_type')) { obj['accrual_type'] = ApiClient.convertToType(data['accrual_type'], 'String'); } if (data.hasOwnProperty('points')) { obj['points'] = ApiClient.convertToType(data['points'], 'Number'); } if (data.hasOwnProperty('visit_minimum_amount_money')) { obj['visit_minimum_amount_money'] = Money.constructFromObject(data['visit_minimum_amount_money']); } if (data.hasOwnProperty('spend_amount_money')) { obj['spend_amount_money'] = Money.constructFromObject(data['spend_amount_money']); } if (data.hasOwnProperty('catalog_object_id')) { obj['catalog_object_id'] = ApiClient.convertToType(data['catalog_object_id'], 'String'); } } return obj; } /** * The type of the accrual rule that defines how buyers can earn points. See [LoyaltyProgramAccrualRuleType](#type-loyaltyprogramaccrualruletype) for possible values * @member {String} accrual_type */ exports.prototype['accrual_type'] = undefined; /** * The number of points that buyers earn based on the `accrual_type`. * @member {Number} points */ exports.prototype['points'] = undefined; /** * When the accrual rule is visit-based (`accrual_type` is `VISIT`), this field indicates the minimum purchase required during the visit to quality for the reward. * @member {module:model/Money} visit_minimum_amount_money */ exports.prototype['visit_minimum_amount_money'] = undefined; /** * When the accrual rule is spend-based (`accrual_type` is `SPEND`), this field indicates the amount that a buyer must spend to earn the points. For example, suppose the accrual rule is \"earn 1 point for every $10 you spend\". Then, buyer earns a point for every $10 they spend. If buyer spends $105, the buyer earns 10 points. * @member {module:model/Money} spend_amount_money */ exports.prototype['spend_amount_money'] = undefined; /** * The ID of the `catalog object` to purchase to earn the number of points defined by the rule. This is either an item variation or a category, depending on the type. This is defined on `ITEM_VARIATION` rules and `CATEGORY` rules. * @member {String} catalog_object_id */ exports.prototype['catalog_object_id'] = undefined; module.exports = exports;