UNPKG

beerbay-math

Version:

27 lines (21 loc) 807 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFullPrice = void 0; var _cart = require("./cart"); var _shipping = require("./shipping"); var _coupon = require("./coupon"); /** * @method getFullPrice * @description Given the cart, country, coupon and user it calculates the total price * @param {*} cart * @param {*} selectedCountry * @param {*} coupon * @param {*} user */ var getFullPrice = function getFullPrice(cart, selectedCountry, coupon, user) { var price = (0, _cart.getCartPrice)(cart, selectedCountry) + parseFloat((0, _shipping.getShippingFinal)(cart, selectedCountry, coupon, user)) - parseFloat((0, _coupon.getCouponValue)(cart, selectedCountry, coupon, user)); return Number(price.toFixed(2)); }; exports.getFullPrice = getFullPrice;