foodbot-cart-calculations 1.0.36 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,7 +120,10 @@ function getCategorySpeificOffer(carts, offer) {
120
120
  if (parseFloat(offer.oo_min_amount) <= parseFloat(afterTotal)) {
121
121
 
122
122
  if (offer.offer_discount_type != 'manual')
123
- offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(Number);
123
+ // offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(Number);
124
+ offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(x =>
125
+ typeof x === "string" && !isNaN(x) ? Number(x) : x
126
+ );
124
127
 
125
128
  if (offer.offer_discount_type != 'manual')
126
129
  if (offer.offer_products.package_items) {
@@ -359,7 +362,7 @@ function getCategorySpeificOffer(carts, offer) {
359
362
  count++
360
363
  }
361
364
 
362
- // console.log("count", count)
365
+ // console.log("count", total)
363
366
  if (count == carts.item_details.length && carts.item_details) {
364
367
  if ((Number(total) < Number(offerAmount) || Number(total) > Number(offerAmount)) && offer.oo_offer_type != 'percentage') {
365
368
  let difference = Number(offerAmount) - Number(total)
@@ -812,7 +815,10 @@ function getFreeProductOffer(cartObject, offer) {
812
815
  var total = 0;
813
816
  var count = 0;
814
817
  var offerAmount = offer.oo_offer_value;
815
- offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(Number);
818
+ // offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(Number);
819
+ offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(x =>
820
+ typeof x === "string" && !isNaN(x) ? Number(x) : x
821
+ );
816
822
 
817
823
  var cartItem = carts;
818
824
  if (offer.offer_products.order_modifiercost_use == 1) {
@@ -942,8 +948,14 @@ function getFixedPriceProductOffer(cartObject, offer) {
942
948
  var count = 0;
943
949
  var fixedPrice = offer.oo_offer_value;
944
950
 
945
- offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(Number);
946
- offer.offer_products.package_items = offer.offer_products.package_items.map(Number);
951
+ // offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(Number);
952
+ offer.offer_products.offer_discount_products = offer.offer_products.offer_discount_products.map(x =>
953
+ typeof x === "string" && !isNaN(x) ? Number(x) : x
954
+ );
955
+ // offer.offer_products.package_items = offer.offer_products.package_items.map(Number);
956
+ offer.offer_products.package_items = offer.offer_products.package_items.map(x =>
957
+ typeof x === "string" && !isNaN(x) ? Number(x) : x
958
+ );
947
959
 
948
960
  var cartItem = carts;
949
961
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foodbot-cart-calculations",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "Package for cart calculations in which it performs discount distribution and tax distribution on order",
5
5
  "main": "index.js",
6
6
  "scripts": {