washday-sdk 0.0.172 → 0.0.174

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.
@@ -48,6 +48,9 @@ export const calculateTotalTaxesIncluded = (order, selectedCustomer, storeSettin
48
48
  if (discountType === 'percentage' && current.isBuyAndGetProduct) {
49
49
  discPercentageInteger = +(discountValue / 100).toFixed(2);
50
50
  }
51
+ if (discountType === 'free' && current.isBuyAndGetProduct) {
52
+ discPercentageInteger = 1;
53
+ }
51
54
  }
52
55
  }
53
56
  // === NUEVO: Aplicar descuento sobre el precio total ajustado (producto base + extra prorrateado) ===
@@ -47,6 +47,9 @@ export const calculateTotalTaxesOverPrice = (order, selectedCustomer, storeSetti
47
47
  if (condition.getDiscountType === BuyAndGetConditionsTypes.PERCENTAGE && current.isBuyAndGetProduct) {
48
48
  discPercentageInteger = +(condition.discountValue / 100).toFixed(2);
49
49
  }
50
+ if (condition.getDiscountType === BuyAndGetConditionsTypes.FREE && current.isBuyAndGetProduct) {
51
+ discPercentageInteger = 1;
52
+ }
50
53
  }
51
54
  }
52
55
  // Calcular el descuento por unidad sobre el precio ajustado
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.172",
3
+ "version": "0.0.174",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -30,9 +30,9 @@ export const calculateTotalTaxesIncluded = (
30
30
  if (!order.discountCode) {
31
31
  const discountsToApply = storeDiscounts.filter(
32
32
  (discount: any) => discount.isActive && discount.products.some((p: any) => {
33
- if(typeof p === 'string') {
33
+ if (typeof p === 'string') {
34
34
  return p === current._id
35
- } else if(typeof p === 'object') {
35
+ } else if (typeof p === 'object') {
36
36
  return p._id === current._id
37
37
  }
38
38
  return false
@@ -59,6 +59,9 @@ export const calculateTotalTaxesIncluded = (
59
59
  if (discountType === 'percentage' && current.isBuyAndGetProduct) {
60
60
  discPercentageInteger = +(discountValue / 100).toFixed(2);
61
61
  }
62
+ if (discountType === 'free' && current.isBuyAndGetProduct) {
63
+ discPercentageInteger = 1;
64
+ }
62
65
  }
63
66
  }
64
67
 
@@ -56,6 +56,9 @@ export const calculateTotalTaxesOverPrice = (
56
56
  if (condition.getDiscountType === BuyAndGetConditionsTypes.PERCENTAGE && current.isBuyAndGetProduct) {
57
57
  discPercentageInteger = +(condition.discountValue / 100).toFixed(2);
58
58
  }
59
+ if (condition.getDiscountType === BuyAndGetConditionsTypes.FREE && current.isBuyAndGetProduct) {
60
+ discPercentageInteger = 1;
61
+ }
59
62
  }
60
63
  }
61
64