@darkpos/pricing 1.0.111 → 1.0.114
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.
- package/__TEST__/item.test.js +131 -0
- package/__TEST__/order/conditionsNotMet.test.js +176 -18
- package/lib/item/calculate.js +1 -0
- package/lib/item/validateModifiers.js +9 -4
- package/lib/modifier/areConditionsMet.js +11 -5
- package/lib/modifier/isAvailableSubscription.js +3 -3
- package/lib/order/getOrderItemSubscriptions.js +4 -4
- package/lib/order/hasRemainingSubscription.js +10 -12
- package/package.json +2 -2
package/__TEST__/item.test.js
CHANGED
|
@@ -1831,4 +1831,135 @@ describe('Item actions', () => {
|
|
|
1831
1831
|
_actual: 200,
|
|
1832
1832
|
});
|
|
1833
1833
|
});
|
|
1834
|
+
|
|
1835
|
+
test('Should calculate a price override modifier and a tax modifier properly', () => {
|
|
1836
|
+
const overridePriceMod = {
|
|
1837
|
+
_id: '675354ee39a47228afd1f1a4',
|
|
1838
|
+
attributes: ['override'],
|
|
1839
|
+
modifierId: '6751f7eeb60c71cefee138ee',
|
|
1840
|
+
name: 'Override item price fixed 0',
|
|
1841
|
+
tags: ['default', 'all'],
|
|
1842
|
+
direct: true,
|
|
1843
|
+
properties: {
|
|
1844
|
+
override: {
|
|
1845
|
+
type: 'fixed',
|
|
1846
|
+
field: 'price',
|
|
1847
|
+
fixedValue: 5,
|
|
1848
|
+
multiplier: false,
|
|
1849
|
+
},
|
|
1850
|
+
},
|
|
1851
|
+
};
|
|
1852
|
+
|
|
1853
|
+
const percentageFee10 = {
|
|
1854
|
+
compute: {
|
|
1855
|
+
amount: 10,
|
|
1856
|
+
type: 'percentage',
|
|
1857
|
+
action: 'add',
|
|
1858
|
+
},
|
|
1859
|
+
name: 'percentageFee10',
|
|
1860
|
+
type: 'tax',
|
|
1861
|
+
_id: '234',
|
|
1862
|
+
modifierId: 222,
|
|
1863
|
+
};
|
|
1864
|
+
|
|
1865
|
+
const itemWithModifierAmountFixed10 = {
|
|
1866
|
+
name: "Men's 3pc Tuxedo",
|
|
1867
|
+
pieces: 1,
|
|
1868
|
+
price: 10,
|
|
1869
|
+
quantity: 1,
|
|
1870
|
+
modifiers: [overridePriceMod, percentageFee10],
|
|
1871
|
+
_id: '675354e939a47228afd1f199',
|
|
1872
|
+
itemId: '62cdbfd01ee1b400193281ee',
|
|
1873
|
+
};
|
|
1874
|
+
const newItem = pricingService.item.calculate(
|
|
1875
|
+
itemWithModifierAmountFixed10
|
|
1876
|
+
);
|
|
1877
|
+
expect(newItem.price).toBe(5);
|
|
1878
|
+
expect(newItem.total).toBe(5.5);
|
|
1879
|
+
expect(newItem.modifiers[0]).toHaveProperty('_computed', {
|
|
1880
|
+
amount: 0,
|
|
1881
|
+
description: 'Override item price fixed 0 ($5.00/Unit)',
|
|
1882
|
+
});
|
|
1883
|
+
|
|
1884
|
+
expect(newItem.modifiers[1]).toHaveProperty('_computed', {
|
|
1885
|
+
amount: 0.5,
|
|
1886
|
+
description: 'percentageFee10 ($0.50)',
|
|
1887
|
+
});
|
|
1888
|
+
|
|
1889
|
+
expect(newItem).toHaveProperty('subTotals', {
|
|
1890
|
+
_included: 0,
|
|
1891
|
+
_xincluded: 0.5,
|
|
1892
|
+
_direct: 0,
|
|
1893
|
+
_xdirect: 0.5,
|
|
1894
|
+
_simple: 5,
|
|
1895
|
+
_actual: 5,
|
|
1896
|
+
tax: 0.5,
|
|
1897
|
+
});
|
|
1898
|
+
});
|
|
1899
|
+
|
|
1900
|
+
test('Should calculate a tax modifier and a price override modifier properly', () => {
|
|
1901
|
+
const overridePriceMod = {
|
|
1902
|
+
_id: '675354ee39a47228afd1f1a4',
|
|
1903
|
+
attributes: ['override'],
|
|
1904
|
+
modifierId: '6751f7eeb60c71cefee138ee',
|
|
1905
|
+
name: 'Override item price fixed 0',
|
|
1906
|
+
tags: ['default', 'all'],
|
|
1907
|
+
direct: true,
|
|
1908
|
+
properties: {
|
|
1909
|
+
override: {
|
|
1910
|
+
type: 'fixed',
|
|
1911
|
+
field: 'price',
|
|
1912
|
+
fixedValue: 5,
|
|
1913
|
+
multiplier: false,
|
|
1914
|
+
},
|
|
1915
|
+
},
|
|
1916
|
+
};
|
|
1917
|
+
|
|
1918
|
+
const percentageFee10 = {
|
|
1919
|
+
compute: {
|
|
1920
|
+
amount: 10,
|
|
1921
|
+
type: 'percentage',
|
|
1922
|
+
action: 'add',
|
|
1923
|
+
},
|
|
1924
|
+
name: 'percentageFee10',
|
|
1925
|
+
type: 'tax',
|
|
1926
|
+
_id: '234',
|
|
1927
|
+
modifierId: 222,
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
const itemWithModifierAmountFixed10 = {
|
|
1931
|
+
name: "Men's 3pc Tuxedo",
|
|
1932
|
+
pieces: 1,
|
|
1933
|
+
price: 10,
|
|
1934
|
+
quantity: 1,
|
|
1935
|
+
modifiers: [percentageFee10, overridePriceMod],
|
|
1936
|
+
_id: '675354e939a47228afd1f199',
|
|
1937
|
+
itemId: '62cdbfd01ee1b400193281ee',
|
|
1938
|
+
};
|
|
1939
|
+
const newItem = pricingService.item.calculate(
|
|
1940
|
+
itemWithModifierAmountFixed10
|
|
1941
|
+
);
|
|
1942
|
+
expect(newItem.price).toBe(5);
|
|
1943
|
+
expect(newItem.total).toBe(6);
|
|
1944
|
+
|
|
1945
|
+
expect(newItem.modifiers[0]).toHaveProperty('_computed', {
|
|
1946
|
+
amount: 1,
|
|
1947
|
+
description: 'percentageFee10 ($1.00)',
|
|
1948
|
+
});
|
|
1949
|
+
|
|
1950
|
+
expect(newItem.modifiers[1]).toHaveProperty('_computed', {
|
|
1951
|
+
amount: 0,
|
|
1952
|
+
description: 'Override item price fixed 0 ($5.00/Unit)',
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
expect(newItem).toHaveProperty('subTotals', {
|
|
1956
|
+
_included: 0,
|
|
1957
|
+
_xincluded: 1,
|
|
1958
|
+
_direct: 0,
|
|
1959
|
+
_xdirect: 1,
|
|
1960
|
+
_simple: 5,
|
|
1961
|
+
_actual: 5,
|
|
1962
|
+
tax: 1,
|
|
1963
|
+
});
|
|
1964
|
+
});
|
|
1834
1965
|
});
|
|
@@ -1626,12 +1626,48 @@ describe('Conditions not met for the item', () => {
|
|
|
1626
1626
|
});
|
|
1627
1627
|
|
|
1628
1628
|
test('Total number of items conditions is met, using between', () => {
|
|
1629
|
-
const item1 = {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1629
|
+
const item1 = {
|
|
1630
|
+
pieces: 1,
|
|
1631
|
+
itemId: '1',
|
|
1632
|
+
price: 100,
|
|
1633
|
+
modifiers: [],
|
|
1634
|
+
quantity: 1,
|
|
1635
|
+
};
|
|
1636
|
+
const item2 = {
|
|
1637
|
+
pieces: 1,
|
|
1638
|
+
itemId: '2',
|
|
1639
|
+
price: 100,
|
|
1640
|
+
modifiers: [],
|
|
1641
|
+
quantity: 1,
|
|
1642
|
+
};
|
|
1643
|
+
const item3 = {
|
|
1644
|
+
pieces: 1,
|
|
1645
|
+
itemId: '3',
|
|
1646
|
+
price: 100,
|
|
1647
|
+
modifiers: [],
|
|
1648
|
+
quantity: 1,
|
|
1649
|
+
};
|
|
1650
|
+
const item4 = {
|
|
1651
|
+
pieces: 1,
|
|
1652
|
+
itemId: '4',
|
|
1653
|
+
price: 100,
|
|
1654
|
+
modifiers: [],
|
|
1655
|
+
quantity: 1,
|
|
1656
|
+
};
|
|
1657
|
+
const item5 = {
|
|
1658
|
+
pieces: 1,
|
|
1659
|
+
itemId: '5',
|
|
1660
|
+
price: 100,
|
|
1661
|
+
modifiers: [],
|
|
1662
|
+
quantity: 1,
|
|
1663
|
+
};
|
|
1664
|
+
const item6 = {
|
|
1665
|
+
pieces: 1,
|
|
1666
|
+
itemId: '6',
|
|
1667
|
+
price: 100,
|
|
1668
|
+
modifiers: [],
|
|
1669
|
+
quantity: 1,
|
|
1670
|
+
};
|
|
1635
1671
|
|
|
1636
1672
|
const order = {
|
|
1637
1673
|
id: 'ord-123',
|
|
@@ -1667,10 +1703,34 @@ describe('Conditions not met for the item', () => {
|
|
|
1667
1703
|
});
|
|
1668
1704
|
|
|
1669
1705
|
test('Total number of items conditions is not met, using between', () => {
|
|
1670
|
-
const item1 = {
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1706
|
+
const item1 = {
|
|
1707
|
+
pieces: 1,
|
|
1708
|
+
itemId: '1',
|
|
1709
|
+
price: 100,
|
|
1710
|
+
modifiers: [],
|
|
1711
|
+
quantity: 1,
|
|
1712
|
+
};
|
|
1713
|
+
const item2 = {
|
|
1714
|
+
pieces: 1,
|
|
1715
|
+
itemId: '2',
|
|
1716
|
+
price: 100,
|
|
1717
|
+
modifiers: [],
|
|
1718
|
+
quantity: 1,
|
|
1719
|
+
};
|
|
1720
|
+
const item3 = {
|
|
1721
|
+
pieces: 1,
|
|
1722
|
+
itemId: '3',
|
|
1723
|
+
price: 100,
|
|
1724
|
+
modifiers: [],
|
|
1725
|
+
quantity: 1,
|
|
1726
|
+
};
|
|
1727
|
+
const item4 = {
|
|
1728
|
+
pieces: 1,
|
|
1729
|
+
itemId: '4',
|
|
1730
|
+
price: 100,
|
|
1731
|
+
modifiers: [],
|
|
1732
|
+
quantity: 1,
|
|
1733
|
+
};
|
|
1674
1734
|
|
|
1675
1735
|
const order = {
|
|
1676
1736
|
id: 'ord-123',
|
|
@@ -1706,10 +1766,34 @@ describe('Conditions not met for the item', () => {
|
|
|
1706
1766
|
});
|
|
1707
1767
|
|
|
1708
1768
|
test('Total number of items conditions is met, using gt', () => {
|
|
1709
|
-
const item1 = {
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1769
|
+
const item1 = {
|
|
1770
|
+
pieces: 1,
|
|
1771
|
+
itemId: '1',
|
|
1772
|
+
price: 100,
|
|
1773
|
+
modifiers: [],
|
|
1774
|
+
quantity: 1,
|
|
1775
|
+
};
|
|
1776
|
+
const item2 = {
|
|
1777
|
+
pieces: 1,
|
|
1778
|
+
itemId: '2',
|
|
1779
|
+
price: 100,
|
|
1780
|
+
modifiers: [],
|
|
1781
|
+
quantity: 1,
|
|
1782
|
+
};
|
|
1783
|
+
const item3 = {
|
|
1784
|
+
pieces: 1,
|
|
1785
|
+
itemId: '3',
|
|
1786
|
+
price: 100,
|
|
1787
|
+
modifiers: [],
|
|
1788
|
+
quantity: 1,
|
|
1789
|
+
};
|
|
1790
|
+
const item4 = {
|
|
1791
|
+
pieces: 1,
|
|
1792
|
+
itemId: '4',
|
|
1793
|
+
price: 100,
|
|
1794
|
+
modifiers: [],
|
|
1795
|
+
quantity: 1,
|
|
1796
|
+
};
|
|
1713
1797
|
|
|
1714
1798
|
const order = {
|
|
1715
1799
|
id: 'ord-123',
|
|
@@ -1742,10 +1826,34 @@ describe('Conditions not met for the item', () => {
|
|
|
1742
1826
|
});
|
|
1743
1827
|
|
|
1744
1828
|
test('Total number of items conditions is not met, using gt', () => {
|
|
1745
|
-
const item1 = {
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1829
|
+
const item1 = {
|
|
1830
|
+
pieces: 1,
|
|
1831
|
+
itemId: '1',
|
|
1832
|
+
price: 100,
|
|
1833
|
+
modifiers: [],
|
|
1834
|
+
quantity: 1,
|
|
1835
|
+
};
|
|
1836
|
+
const item2 = {
|
|
1837
|
+
pieces: 1,
|
|
1838
|
+
itemId: '2',
|
|
1839
|
+
price: 100,
|
|
1840
|
+
modifiers: [],
|
|
1841
|
+
quantity: 1,
|
|
1842
|
+
};
|
|
1843
|
+
const item3 = {
|
|
1844
|
+
pieces: 1,
|
|
1845
|
+
itemId: '3',
|
|
1846
|
+
price: 100,
|
|
1847
|
+
modifiers: [],
|
|
1848
|
+
quantity: 1,
|
|
1849
|
+
};
|
|
1850
|
+
const item4 = {
|
|
1851
|
+
pieces: 1,
|
|
1852
|
+
itemId: '4',
|
|
1853
|
+
price: 100,
|
|
1854
|
+
modifiers: [],
|
|
1855
|
+
quantity: 1,
|
|
1856
|
+
};
|
|
1749
1857
|
|
|
1750
1858
|
const order = {
|
|
1751
1859
|
id: 'ord-123',
|
|
@@ -1776,4 +1884,54 @@ describe('Conditions not met for the item', () => {
|
|
|
1776
1884
|
false
|
|
1777
1885
|
);
|
|
1778
1886
|
});
|
|
1887
|
+
|
|
1888
|
+
test('Total number of items conditions is met with 2 items with each one having qty 3, using between', () => {
|
|
1889
|
+
const item1 = {
|
|
1890
|
+
pieces: 1,
|
|
1891
|
+
itemId: '1',
|
|
1892
|
+
price: 100,
|
|
1893
|
+
modifiers: [],
|
|
1894
|
+
quantity: 3,
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1897
|
+
const item2 = {
|
|
1898
|
+
pieces: 1,
|
|
1899
|
+
itemId: '1',
|
|
1900
|
+
price: 100,
|
|
1901
|
+
modifiers: [],
|
|
1902
|
+
quantity: 3,
|
|
1903
|
+
};
|
|
1904
|
+
|
|
1905
|
+
const order = {
|
|
1906
|
+
id: 'ord-123',
|
|
1907
|
+
items: [item1, item2],
|
|
1908
|
+
modifiers: [],
|
|
1909
|
+
};
|
|
1910
|
+
const modifier = {
|
|
1911
|
+
conditions: {
|
|
1912
|
+
rules: [
|
|
1913
|
+
{
|
|
1914
|
+
key: 'totalNumberOfItems',
|
|
1915
|
+
value: {
|
|
1916
|
+
from: 5,
|
|
1917
|
+
to: 10,
|
|
1918
|
+
},
|
|
1919
|
+
operand: '$between',
|
|
1920
|
+
},
|
|
1921
|
+
],
|
|
1922
|
+
},
|
|
1923
|
+
};
|
|
1924
|
+
const { addItemModifier } = pricingService.order;
|
|
1925
|
+
const calculatedOrder = pricingService.order.calculate(
|
|
1926
|
+
addItemModifier({
|
|
1927
|
+
order,
|
|
1928
|
+
modifier,
|
|
1929
|
+
itemIndex: 0,
|
|
1930
|
+
})
|
|
1931
|
+
);
|
|
1932
|
+
expect(calculatedOrder.items[0].modifiers.length).toEqual(1);
|
|
1933
|
+
expect(calculatedOrder.items[0].modifiers[0].conditions.valid).toEqual(
|
|
1934
|
+
true
|
|
1935
|
+
);
|
|
1936
|
+
});
|
|
1779
1937
|
});
|
package/lib/item/calculate.js
CHANGED
|
@@ -24,20 +24,25 @@ module.exports = ({ modifierActions }) =>
|
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
+
const isIdMatch = (mod, modifierId) => {
|
|
28
|
+
if (typeof mod === 'string') return mod === modifierId;
|
|
29
|
+
return mod._id === modifierId;
|
|
30
|
+
};
|
|
31
|
+
|
|
27
32
|
firstValidatedModifiers.forEach(validModifier => {
|
|
28
33
|
const parentAddModifier = firstValidatedModifiers.find(
|
|
29
34
|
validMod =>
|
|
30
35
|
validMod.addModifiers &&
|
|
31
|
-
validMod.addModifiers.some(
|
|
32
|
-
addMod
|
|
36
|
+
validMod.addModifiers.some(addMod =>
|
|
37
|
+
isIdMatch(addMod, validModifier.modifierId)
|
|
33
38
|
)
|
|
34
39
|
);
|
|
35
40
|
|
|
36
41
|
const parentDelModifier = firstValidatedModifiers.find(
|
|
37
42
|
validMod =>
|
|
38
43
|
validMod.delModifiers &&
|
|
39
|
-
validMod.delModifiers.some(
|
|
40
|
-
delMod
|
|
44
|
+
validMod.delModifiers.some(delMod =>
|
|
45
|
+
isIdMatch(delMod, validModifier.modifierId)
|
|
41
46
|
)
|
|
42
47
|
);
|
|
43
48
|
|
|
@@ -10,6 +10,14 @@ module.exports = ({ actions, utils }) => {
|
|
|
10
10
|
return customer.stats[key];
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
const getTotalItemsQuantity = ({ items }) => {
|
|
14
|
+
if (!items || !Array.isArray(items)) return 0;
|
|
15
|
+
return items.reduce(
|
|
16
|
+
(total, item) => utils.math.add(total, item.quantity || 0),
|
|
17
|
+
0
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
13
21
|
const modifierConditionPass = (
|
|
14
22
|
modifier,
|
|
15
23
|
{
|
|
@@ -28,7 +36,7 @@ module.exports = ({ actions, utils }) => {
|
|
|
28
36
|
switch (condition.key) {
|
|
29
37
|
case 'totalNumberOfItems':
|
|
30
38
|
return actions.validateNumberCondition({
|
|
31
|
-
value:
|
|
39
|
+
value: getTotalItemsQuantity({ items: allItems }),
|
|
32
40
|
condition,
|
|
33
41
|
});
|
|
34
42
|
case 'itemSet': {
|
|
@@ -57,10 +65,8 @@ module.exports = ({ actions, utils }) => {
|
|
|
57
65
|
}
|
|
58
66
|
});
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
matchingItems.forEach(matchItem => {
|
|
63
|
-
totalItemsLength += matchItem.quantity || 0;
|
|
68
|
+
const totalItemsLength = getTotalItemsQuantity({
|
|
69
|
+
items: matchingItems,
|
|
64
70
|
});
|
|
65
71
|
|
|
66
72
|
const itemIndex = matchingItems.findIndex(
|
|
@@ -14,9 +14,9 @@ module.exports = ({ utils, actions }) => {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
if (
|
|
17
|
-
properties.
|
|
18
|
-
properties.
|
|
19
|
-
math.gte(properties.
|
|
17
|
+
properties.uses &&
|
|
18
|
+
properties.usesLimit &&
|
|
19
|
+
math.gte(properties.uses, properties.usesLimit)
|
|
20
20
|
)
|
|
21
21
|
return false;
|
|
22
22
|
|
|
@@ -26,15 +26,15 @@ module.exports = ({ actions, itemActions, modifierActions, utils, _ }) => {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const { quantity, price } = orderItem;
|
|
29
|
-
let
|
|
29
|
+
let uses = quantity;
|
|
30
30
|
if (remaining) {
|
|
31
31
|
const left = remaining - (used || 0);
|
|
32
|
-
if (quantity > left)
|
|
32
|
+
if (quantity > left) uses = left;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const modifier = modifierActions.createSubscriptionModifier({
|
|
36
|
-
amount: math.mul(
|
|
37
|
-
properties: { subscription: {
|
|
36
|
+
amount: math.mul(uses, price),
|
|
37
|
+
properties: { subscription: { uses } },
|
|
38
38
|
});
|
|
39
39
|
orderItem.modifiers.push(modifier);
|
|
40
40
|
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
module.exports = ({ actions, modifierActions }) => {
|
|
2
2
|
const getRemaining = (subscriptions, orderId) => {
|
|
3
3
|
const remaining = subscriptions.reduce((total, subscription) => {
|
|
4
|
-
const {
|
|
5
|
-
numberOfUsesLimit = 0,
|
|
6
|
-
numberOfUses = 0,
|
|
7
|
-
history = {},
|
|
8
|
-
} = subscription;
|
|
4
|
+
const { usesLimit = 0, uses = 0, history = {} } = subscription;
|
|
9
5
|
const orderHistory = history[orderId] || 0;
|
|
10
|
-
return total +
|
|
6
|
+
return total + usesLimit + orderHistory - uses;
|
|
11
7
|
}, 0);
|
|
12
8
|
|
|
13
9
|
return remaining;
|
|
@@ -27,16 +23,16 @@ module.exports = ({ actions, modifierActions }) => {
|
|
|
27
23
|
],
|
|
28
24
|
[]
|
|
29
25
|
);
|
|
30
|
-
const
|
|
26
|
+
const uses = modifiers.reduce(
|
|
31
27
|
(sum, each) =>
|
|
32
28
|
sum +
|
|
33
29
|
((each.properties &&
|
|
34
30
|
each.properties.subscription &&
|
|
35
|
-
each.properties.subscription.
|
|
31
|
+
each.properties.subscription.uses) ||
|
|
36
32
|
0),
|
|
37
33
|
0
|
|
38
34
|
);
|
|
39
|
-
return
|
|
35
|
+
return uses;
|
|
40
36
|
};
|
|
41
37
|
|
|
42
38
|
const getSubscriptions = subscriptions =>
|
|
@@ -56,12 +52,14 @@ module.exports = ({ actions, modifierActions }) => {
|
|
|
56
52
|
|
|
57
53
|
subscriptions = getSubscriptions(subscriptions);
|
|
58
54
|
|
|
59
|
-
const isUnlimited = subscriptions.some(
|
|
55
|
+
const isUnlimited = subscriptions.some(
|
|
56
|
+
each => !each.usesLimit || each.renewalType === 'limit_reached'
|
|
57
|
+
);
|
|
60
58
|
if (isUnlimited) return [true];
|
|
61
59
|
|
|
62
60
|
const remaining = getRemaining(subscriptions, order.parentId || order._id);
|
|
63
|
-
const
|
|
61
|
+
const uses = getNumberOfUses(order.items, item);
|
|
64
62
|
|
|
65
|
-
return [remaining >
|
|
63
|
+
return [remaining > uses, remaining, uses];
|
|
66
64
|
};
|
|
67
65
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkpos/pricing",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.114",
|
|
4
4
|
"description": "Pricing calculator",
|
|
5
5
|
"author": "Dark POS",
|
|
6
6
|
"license": "ISC",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"supertest": "^6.2.3",
|
|
56
56
|
"supervisor": "^0.12.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "cf91c373155b5fe5207ec9234abffd772fd3df40"
|
|
59
59
|
}
|