square-connect
Version:
JavaScript client library for the Square Connect v2 API
115 lines (95 loc) • 6.47 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');
/**
* The LoyaltyProgramRewardDefinition model module.
* Note: This model is in beta.
* @module model/LoyaltyProgramRewardDefinition
*/
/**
* Constructs a new <code>LoyaltyProgramRewardDefinition</code>.
* Provides details about the reward tier discount. DEPRECATED at version 2020-12-16. Discount details are now defined using a catalog pricing rule and other catalog objects. For more information, see [Get discount details for the reward](/docs/loyalty-api/overview#get-discount-details).
* @alias module:model/LoyaltyProgramRewardDefinition
* @class
* @param scope {String} Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. You can find this information in the `discount_target_scope` field of the `PRICING_RULE` catalog object and the `product_set_data` field of the `PRODUCT_SET` catalog object referenced by the pricing rule. For `ORDER` scopes, the target scope is `WHOLE_PURCHASE` and `all_products` is true. For `ITEM_VARIATION` and `CATEGORY` scopes, the target scope is `LINE_ITEM` and `product_ids_any` is a list of catalog object IDs of the given type. See [LoyaltyProgramRewardDefinitionScope](#type-loyaltyprogramrewarddefinitionscope) for possible values
* @param discountType {String} The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.discount_type` field of the `DISCOUNT` catalog object referenced by the pricing rule. See [LoyaltyProgramRewardDefinitionType](#type-loyaltyprogramrewarddefinitiontype) for possible values
*/
var exports = function(scope, discountType) {
var _this = this;
_this['scope'] = scope;
_this['discount_type'] = discountType;
};
/**
* Constructs a <code>LoyaltyProgramRewardDefinition</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/LoyaltyProgramRewardDefinition} obj Optional instance to populate.
* @return {module:model/LoyaltyProgramRewardDefinition} The populated <code>LoyaltyProgramRewardDefinition</code> instance.
*/
exports.constructFromObject = function(data, obj) {
if (data) {
obj = obj || new exports();
if (data.hasOwnProperty('scope')) {
obj['scope'] = ApiClient.convertToType(data['scope'], 'String');
}
if (data.hasOwnProperty('discount_type')) {
obj['discount_type'] = ApiClient.convertToType(data['discount_type'], 'String');
}
if (data.hasOwnProperty('percentage_discount')) {
obj['percentage_discount'] = ApiClient.convertToType(data['percentage_discount'], 'String');
}
if (data.hasOwnProperty('catalog_object_ids')) {
obj['catalog_object_ids'] = ApiClient.convertToType(data['catalog_object_ids'], ['String']);
}
if (data.hasOwnProperty('fixed_discount_money')) {
obj['fixed_discount_money'] = Money.constructFromObject(data['fixed_discount_money']);
}
if (data.hasOwnProperty('max_discount_money')) {
obj['max_discount_money'] = Money.constructFromObject(data['max_discount_money']);
}
}
return obj;
}
/**
* Indicates the scope of the reward tier. DEPRECATED at version 2020-12-16. You can find this information in the `discount_target_scope` field of the `PRICING_RULE` catalog object and the `product_set_data` field of the `PRODUCT_SET` catalog object referenced by the pricing rule. For `ORDER` scopes, the target scope is `WHOLE_PURCHASE` and `all_products` is true. For `ITEM_VARIATION` and `CATEGORY` scopes, the target scope is `LINE_ITEM` and `product_ids_any` is a list of catalog object IDs of the given type. See [LoyaltyProgramRewardDefinitionScope](#type-loyaltyprogramrewarddefinitionscope) for possible values
* @member {String} scope
*/
exports.prototype['scope'] = undefined;
/**
* The type of discount the reward tier offers. DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.discount_type` field of the `DISCOUNT` catalog object referenced by the pricing rule. See [LoyaltyProgramRewardDefinitionType](#type-loyaltyprogramrewarddefinitiontype) for possible values
* @member {String} discount_type
*/
exports.prototype['discount_type'] = undefined;
/**
* The fixed percentage of the discount. Present if `discount_type` is `FIXED_PERCENTAGE`. For example, a 7.25% off discount will be represented as \"7.25\". DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.percentage` field of the `DISCOUNT` catalog object referenced by the pricing rule.
* @member {String} percentage_discount
*/
exports.prototype['percentage_discount'] = undefined;
/**
* The list of catalog objects to which this reward can be applied. They are either all item-variation ids or category ids, depending on the `type` field. DEPRECATED at version 2020-12-16. You can find this information in the `product_set_data.product_ids_any` field of the `PRODUCT_SET` catalog object referenced by the pricing rule.
* @member {Array.<String>} catalog_object_ids
*/
exports.prototype['catalog_object_ids'] = undefined;
/**
* The amount of the discount. Present if `discount_type` is `FIXED_AMOUNT`. For example, $5 off. DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.amount_money` field of the `DISCOUNT` catalog object referenced by the pricing rule.
* @member {module:model/Money} fixed_discount_money
*/
exports.prototype['fixed_discount_money'] = undefined;
/**
* When `discount_type` is `FIXED_PERCENTAGE`, the maximum discount amount that can be applied. DEPRECATED at version 2020-12-16. You can find this information in the `discount_data.maximum_amount_money` field of the `DISCOUNT` catalog object referenced by the the pricing rule.
* @member {module:model/Money} max_discount_money
*/
exports.prototype['max_discount_money'] = undefined;
module.exports = exports;