foodbot-cart-calculations 1.0.29 → 1.0.31

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.
@@ -37,7 +37,7 @@ function getPointsDiscount(cartObject, points, userDetails) {
37
37
  } else {
38
38
  let pointsAmount = 0;
39
39
  let count = 0;
40
- let storeAmount = points.store_value;
40
+ let storeAmount = points.store_value ?? (points.original_store_value ?? 0);
41
41
  let indexes = [];
42
42
 
43
43
  if (points.redeem_categories && points.redeem_categories != '') {
@@ -9,6 +9,7 @@ function offerCalculation(carts, offer) {
9
9
  if(element.item_modifiers && element.item_modifiers.length>0){
10
10
  element.item_modifiers.forEach(mod => {
11
11
  delete mod.promotion_discount;
12
+ delete mod.points_discount;
12
13
  let modTotal = (mod.modifier_item_price * mod.quantity) * element.quantity
13
14
  carts.total += modTotal
14
15
  });
@@ -19,11 +20,13 @@ function offerCalculation(carts, offer) {
19
20
  if (p.item_modifiers)
20
21
  p.item_modifiers.forEach((pMod) => {
21
22
  delete pMod.points_discount;
23
+ delete pMod.promotion_discount;
22
24
  });
23
25
 
24
26
  if (p.modifiers)
25
27
  p.modifiers.forEach((pMod) => {
26
28
  delete pMod.points_discount;
29
+ delete pMod.promotion_discount;
27
30
  });
28
31
  });
29
32
  }
@@ -76,7 +76,9 @@ function calculateTax2(cart, texSettings, taxType) {
76
76
  if (itemIndex == cart.item_details.length - 1) {
77
77
  cart.cart_total_with_tax = parseFloat(cart.cartTotal) + parseFloat(cart.tax_amount);
78
78
  cart.cart_total_with_tax = parseFloat(cart.cart_total_with_tax).toFixed(2);
79
- resolve(cart);
79
+ setTimeout(() => {
80
+ resolve(cart);
81
+ }, 100);
80
82
  }
81
83
 
82
84
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foodbot-cart-calculations",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
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": {