UNPKG

merchantapi

Version:
77 lines (67 loc) 1.42 kB
/* * (c) Miva Inc <https://www.miva.com/> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ const util = require('./../util'); const { Model } = require('./../abstract'); const Decimal = require('decimal.js-light'); /** * OrderItemDiscount data model. * @class */ class OrderItemDiscount extends Model { /** * OrderItemDiscount Constructor. * @param {Object} data * @returns {void} */ constructor(data = {}) { super(data); if (!util.isNullOrUndefined(this.discount)) this.discount = new Decimal(this.discount); } /** * Get order_id. * @returns {number} */ getOrderId() { return this.getField('order_id', 0); } /** * Get line_id. * @returns {number} */ getLineId() { return this.getField('line_id', 0); } /** * Get pgrp_id. * @returns {number} */ getPriceGroupId() { return this.getField('pgrp_id', 0); } /** * Get display. * @returns {boolean} */ getDisplay() { return this.getField('display', false); } /** * Get descrip. * @returns {string} */ getDescription() { return this.getField('descrip'); } /** * Get discount. * @returns {Decimal} */ getDiscount() { return this.getField('discount', new Decimal(0.00)); } } module.exports.OrderItemDiscount = OrderItemDiscount;