@darkpos/pricing 1.0.136 → 1.0.138

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.
@@ -43,6 +43,7 @@ describe('Order actions', () => {
43
43
  modifiers: [cashDiscountModifier],
44
44
  total: 10,
45
45
  totalPaid: 0,
46
+ _id: 'abc',
46
47
  };
47
48
  let cashPercentageDiscountOrder = pricingService.order.calculate(
48
49
  { items: [orderItem] },
@@ -70,7 +71,7 @@ describe('Order actions', () => {
70
71
  { items: [orderItem] },
71
72
  {
72
73
  paymentType: 'cash',
73
- amountToPay: 1,
74
+ amountsToPay: { abc: 1 },
74
75
  lockPaymentModifiers: true,
75
76
  paymentId: '111',
76
77
  }
@@ -86,7 +87,7 @@ describe('Order actions', () => {
86
87
  cashPercentageDiscountOrder,
87
88
  {
88
89
  paymentType: 'cash',
89
- amountToPay: 2,
90
+ amountsToPay: { abc: 2 },
90
91
  lockPaymentModifiers: true,
91
92
  paymentId: '222',
92
93
  }
@@ -130,7 +131,7 @@ describe('Order actions', () => {
130
131
  cashPercentageDiscountOrder,
131
132
  {
132
133
  paymentType: 'cash',
133
- amountToPay: 7,
134
+ amountsToPay: { abc: 7 },
134
135
  lockPaymentModifiers: true,
135
136
  paymentId: '333',
136
137
  }
@@ -191,6 +192,7 @@ describe('Order actions', () => {
191
192
  },
192
193
  };
193
194
  const orderItem = {
195
+ _id: 'abc',
194
196
  price: 10,
195
197
  quantity: 1,
196
198
  modifiers: [cashDiscountModifier],
@@ -214,7 +216,7 @@ describe('Order actions', () => {
214
216
  { items: [orderItem] },
215
217
  {
216
218
  paymentType: 'cash',
217
- amountToPay: 1,
219
+ amountsToPay: { abc: 1 },
218
220
  lockPaymentModifiers: true,
219
221
  }
220
222
  );
@@ -231,7 +233,7 @@ describe('Order actions', () => {
231
233
  cashFixedDiscountOrder,
232
234
  {
233
235
  paymentType: 'cash',
234
- amountToPay: 100,
236
+ amountsToPay: { abc: 100 },
235
237
  lockPaymentModifiers: true,
236
238
  }
237
239
  );
@@ -286,6 +288,7 @@ describe('Order actions', () => {
286
288
  modifiers: [cashDiscountModifier],
287
289
  total: 10,
288
290
  totalPaid: 0,
291
+ _id: 'abc',
289
292
  };
290
293
 
291
294
  let cashFixedDiscountOrder = pricingService.order.calculate(
@@ -304,7 +307,7 @@ describe('Order actions', () => {
304
307
  { items: [orderItem] },
305
308
  {
306
309
  paymentType: 'cash',
307
- amountToPay: 1,
310
+ amountsToPay: { abc: 1 },
308
311
  lockPaymentModifiers: true,
309
312
  }
310
313
  );
@@ -321,7 +324,7 @@ describe('Order actions', () => {
321
324
  cashFixedDiscountOrder,
322
325
  {
323
326
  paymentType: 'cash',
324
- amountToPay: 100,
327
+ amountsToPay: { abc: 100 },
325
328
  lockPaymentModifiers: true,
326
329
  }
327
330
  );
@@ -376,11 +379,16 @@ describe('Order actions', () => {
376
379
  modifiers: [cashFeeModifier],
377
380
  total: 10,
378
381
  totalPaid: 0,
382
+ _id: 'abc',
379
383
  };
380
384
 
381
385
  const cashPercentageDiscountOrder = pricingService.order.calculate(
382
386
  { items: [orderItem] },
383
- { paymentType: 'cash', amountToPay: 1, lockPaymentModifiers: true }
387
+ {
388
+ paymentType: 'cash',
389
+ amountsToPay: { abc: 1 },
390
+ lockPaymentModifiers: true,
391
+ }
384
392
  );
385
393
 
386
394
  expect(cashPercentageDiscountOrder).toHaveProperty('total', 10.1);
@@ -447,6 +455,7 @@ describe('Order actions', () => {
447
455
  modifiers: [taxModifier, cashFeeModifier],
448
456
  total: 13.5,
449
457
  totalPaid: 0,
458
+ _id: 'abc',
450
459
  };
451
460
 
452
461
  let testOrder = pricingService.order.calculate(
@@ -479,7 +488,7 @@ describe('Order actions', () => {
479
488
 
480
489
  testOrder = pricingService.order.calculate(testOrder, {
481
490
  paymentType: 'cash',
482
- amountToPay: 10.34,
491
+ amountsToPay: { abc: 10.34 },
483
492
  lockPaymentModifiers: true,
484
493
  });
485
494
  testOrder.items[0].totalPaid = 10.34;
@@ -561,11 +570,9 @@ describe('Order actions', () => {
561
570
  // paying with a paymenttype that doesn match the payment modifiers
562
571
  const paidOrderWithCredit = pricingService.order.calculate(testOrder, {
563
572
  paymentType: 'credit',
564
- amountToPay: 1.25,
573
+ amountsToPay: { abc: 1.25 },
565
574
  lockPaymentModifiers: true,
566
575
  });
567
- paidOrderWithCredit.items[0].totalPaid += 1.25;
568
- paidOrderWithCredit.totalPaid += 1.25;
569
576
 
570
577
  const orderBalanceWithCredit = pricingService.order.getOrdersBalance({
571
578
  orders: [paidOrderWithCredit],
@@ -1500,4 +1507,1830 @@ describe('Order actions', () => {
1500
1507
  });
1501
1508
  expect(cashFixedDiscountOrder.items[0].modifiers).toHaveLength(2);
1502
1509
  });
1510
+
1511
+ test('Should calculate order that was partially paid using payment modifiers', () => {
1512
+ const order = {
1513
+ _id: '697a2d53a797183eb248240a',
1514
+ user: '68a0b1b7a4582a7ef17dd169',
1515
+ customer: '68ab3e9f1a3b4b470c5fd3e4',
1516
+ parentId: '697a2d53a797183eb2482407',
1517
+ isParent: false,
1518
+ items: [
1519
+ {
1520
+ itemId: '68a0f6dca4582a7ef17ea70b',
1521
+ name: 'Vest',
1522
+ description: '',
1523
+ serial: null,
1524
+ serialRequired: null,
1525
+ sku: '',
1526
+ price: 6,
1527
+ quantity: 1,
1528
+ pieces: 1,
1529
+ weight: 0,
1530
+ modifiers: [
1531
+ {
1532
+ modifierId: '68a0eedba4582a7ef17e9a35',
1533
+ _parentId: null,
1534
+ locked: false,
1535
+ name: 'Dry Cleaning',
1536
+ sku: '',
1537
+ description: '',
1538
+ group: '',
1539
+ type: '',
1540
+ attributes: ['department'],
1541
+ cost: 0,
1542
+ tags: ['default', 'police'],
1543
+ order: 0,
1544
+ code: 'D',
1545
+ included: false,
1546
+ direct: true,
1547
+ hidden: false,
1548
+ print: false,
1549
+ required: true,
1550
+ recommended: false,
1551
+ default: false,
1552
+ addModifiers: [],
1553
+ delModifiers: [],
1554
+ conditions: {
1555
+ valid: true,
1556
+ rules: [],
1557
+ _id: '697a2d53a797183eb248240e',
1558
+ },
1559
+ compute: null,
1560
+ properties: {
1561
+ group: null,
1562
+ department: {
1563
+ tagSize: 'big',
1564
+ splitUnit: 'quantity',
1565
+ maxItems: '6',
1566
+ autoSplit: true,
1567
+ keepRelatedItems: true,
1568
+ },
1569
+ sort: null,
1570
+ },
1571
+ _computed: {
1572
+ amount: 0,
1573
+ description: 'Dry Cleaning',
1574
+ },
1575
+ _hidden: false,
1576
+ _isDeleted: false,
1577
+ _id: '697a2d3b6b2789e04696c2d2',
1578
+ },
1579
+ {
1580
+ modifierId: '68a1005bb49860bc58c2ce90',
1581
+ _parentId: null,
1582
+ locked: false,
1583
+ name: 'Prepay discount',
1584
+ sku: '',
1585
+ description: '',
1586
+ group: 'Discount',
1587
+ type: 'discount',
1588
+ attributes: [],
1589
+ cost: 0,
1590
+ tags: ['default'],
1591
+ order: 0,
1592
+ code: '',
1593
+ included: false,
1594
+ direct: true,
1595
+ hidden: false,
1596
+ print: true,
1597
+ required: false,
1598
+ recommended: false,
1599
+ default: true,
1600
+ addModifiers: [],
1601
+ delModifiers: [],
1602
+ conditions: {
1603
+ valid: false,
1604
+ rules: [
1605
+ {
1606
+ key: 'payment',
1607
+ operand: '$in',
1608
+ value: 'prepay',
1609
+ _id: '697a2d53a797183eb2482411',
1610
+ },
1611
+ ],
1612
+ _id: '697a2d53a797183eb2482410',
1613
+ },
1614
+ compute: {
1615
+ amount: 10,
1616
+ type: 'percentage',
1617
+ action: 'subtract',
1618
+ _id: '697a2d53a797183eb2482412',
1619
+ },
1620
+ properties: {
1621
+ override: null,
1622
+ sort: 3,
1623
+ isQuantityMultiplier: true,
1624
+ },
1625
+ _computed: {
1626
+ amount: 0,
1627
+ description: 'Prepay discount',
1628
+ },
1629
+ _hidden: false,
1630
+ _isDeleted: false,
1631
+ _id: '697a2d3b6b2789e04696c2d4',
1632
+ },
1633
+ {
1634
+ modifierId: '69715ac9f3244a9a2cfda173',
1635
+ _parentId: null,
1636
+ locked: false,
1637
+ name: 'CASH 2% FEE',
1638
+ sku: '',
1639
+ description: '',
1640
+ group: 'Fee',
1641
+ type: 'fee',
1642
+ attributes: [],
1643
+ cost: 0,
1644
+ tags: ['default'],
1645
+ order: 0,
1646
+ code: '',
1647
+ included: false,
1648
+ direct: true,
1649
+ hidden: false,
1650
+ print: true,
1651
+ required: false,
1652
+ recommended: false,
1653
+ default: false,
1654
+ addModifiers: [],
1655
+ delModifiers: [],
1656
+ conditions: {
1657
+ valid: true,
1658
+ rules: [
1659
+ {
1660
+ key: 'paymentTypes',
1661
+ operand: '$in',
1662
+ value: ['cash'],
1663
+ _id: '697a2d53a797183eb2482415',
1664
+ },
1665
+ ],
1666
+ _id: '697a2d53a797183eb2482414',
1667
+ },
1668
+ compute: {
1669
+ amount: 2,
1670
+ type: 'percentage',
1671
+ action: 'add',
1672
+ _id: '697a2d53a797183eb2482416',
1673
+ },
1674
+ properties: {
1675
+ override: null,
1676
+ sort: 15,
1677
+ },
1678
+ _computed: {
1679
+ amount: 0,
1680
+ description: 'CASH 2% FEE',
1681
+ },
1682
+ _hidden: false,
1683
+ _isDeleted: false,
1684
+ _id: '697a2d3e6b2789e04696c2d5',
1685
+ },
1686
+ {
1687
+ modifierId: '696fe3f0be69c4c8316cf174',
1688
+ _parentId: '696fe3f0be69c4c8316cf174',
1689
+ locked: false,
1690
+ name: 'Modifier 30 days (Orders Ready Fee)',
1691
+ sku: '',
1692
+ description: '',
1693
+ group: 'Fee',
1694
+ type: 'fee',
1695
+ attributes: [],
1696
+ cost: 0,
1697
+ tags: ['default'],
1698
+ order: 0,
1699
+ code: '',
1700
+ included: false,
1701
+ direct: false,
1702
+ hidden: false,
1703
+ print: true,
1704
+ required: false,
1705
+ recommended: false,
1706
+ default: false,
1707
+ addModifiers: [],
1708
+ delModifiers: [],
1709
+ conditions: {
1710
+ valid: true,
1711
+ _id: '697a2e67a797183eb2483a10',
1712
+ rules: [],
1713
+ },
1714
+ compute: {
1715
+ amount: 0.6,
1716
+ type: 'fixed',
1717
+ action: 'add',
1718
+ _id: '697a2e67a797183eb2483a11',
1719
+ },
1720
+ properties: {
1721
+ override: null,
1722
+ sort: 4,
1723
+ isQuantityMultiplier: false,
1724
+ },
1725
+ _computed: {
1726
+ amount: 0.6,
1727
+ description: 'Modifier 30 days (Orders Ready Fee) ($0.60)',
1728
+ },
1729
+ _hidden: false,
1730
+ _isDeleted: false,
1731
+ _id: '697a2e66c18edb2f60f6772f',
1732
+ },
1733
+ {
1734
+ modifierId: '68a10008a4582a7ef17eb3ec',
1735
+ _parentId: null,
1736
+ locked: false,
1737
+ name: 'Tax 5%',
1738
+ sku: '',
1739
+ description: '',
1740
+ group: 'Tax',
1741
+ type: 'tax',
1742
+ attributes: [],
1743
+ cost: 0,
1744
+ tags: ['default'],
1745
+ order: 0,
1746
+ code: '',
1747
+ included: false,
1748
+ direct: true,
1749
+ hidden: false,
1750
+ print: false,
1751
+ required: true,
1752
+ recommended: false,
1753
+ default: false,
1754
+ addModifiers: [],
1755
+ delModifiers: [],
1756
+ conditions: {
1757
+ valid: true,
1758
+ rules: [],
1759
+ _id: '697a2d53a797183eb248241b',
1760
+ },
1761
+ compute: {
1762
+ amount: 5,
1763
+ type: 'percentage',
1764
+ action: 'add',
1765
+ _id: '697a2d53a797183eb248241c',
1766
+ },
1767
+ properties: {
1768
+ override: null,
1769
+ sort: 5,
1770
+ isQuantityMultiplier: true,
1771
+ },
1772
+ _computed: {
1773
+ amount: 0.33,
1774
+ description: 'Tax 5% ($0.33)',
1775
+ },
1776
+ _hidden: false,
1777
+ _isDeleted: false,
1778
+ _id: '697a2d3b6b2789e04696c2d3',
1779
+ },
1780
+ {
1781
+ modifierId: '69715ac9f3244a9a2cfda173',
1782
+ _parentId: '697a2d3e6b2789e04696c2d5',
1783
+ locked: true,
1784
+ name: '$0.14 fee',
1785
+ sku: '',
1786
+ description: '',
1787
+ group: '',
1788
+ type: 'fee',
1789
+ attributes: [],
1790
+ cost: 0,
1791
+ tags: [],
1792
+ order: 0,
1793
+ code: '',
1794
+ included: false,
1795
+ direct: true,
1796
+ hidden: false,
1797
+ print: true,
1798
+ required: false,
1799
+ recommended: false,
1800
+ default: false,
1801
+ addModifiers: [],
1802
+ delModifiers: [],
1803
+ conditions: null,
1804
+ compute: {
1805
+ amount: 0.1386,
1806
+ type: 'fixed',
1807
+ action: 'add',
1808
+ _id: '697a2e67a797183eb2483a16',
1809
+ },
1810
+ properties: {
1811
+ isQuantityMultiplier: false,
1812
+ override: null,
1813
+ sort: 15,
1814
+ isCalculatedPaymentModifier: true,
1815
+ paymentId: '697a2e66a797183eb248397d',
1816
+ },
1817
+ _computed: {
1818
+ amount: 0.1386,
1819
+ description: '$0.14 fee ($0.14)',
1820
+ },
1821
+ _hidden: false,
1822
+ _isDeleted: false,
1823
+ _id: '697a2e66c18edb2f60f67733',
1824
+ },
1825
+ ],
1826
+ total: 7.07,
1827
+ totalPaid: 7.07,
1828
+ path: ',68a0ea81aa30dd1524162285,68a102e959fd1012e3aaa981,',
1829
+ menuRuleId: '68a1039f59fd1012e3aaa991',
1830
+ status: {
1831
+ picked: {
1832
+ value: true,
1833
+ date: '2026-01-28T15:42:25.026Z',
1834
+ },
1835
+ paid: {
1836
+ value: true,
1837
+ date: '2026-01-28T15:42:29.030Z',
1838
+ },
1839
+ tracker: [
1840
+ {
1841
+ date: '2026-01-28T15:42:26.881Z',
1842
+ location: 'Picked up',
1843
+ user: '68a0b1b7a4582a7ef17dd169',
1844
+ },
1845
+ ],
1846
+ },
1847
+ notes: [],
1848
+ subTotals: {
1849
+ _included: 0,
1850
+ _xincluded: 1.0686,
1851
+ _direct: 0.4686,
1852
+ _xdirect: 0.6,
1853
+ _simple: 6,
1854
+ _actual: 6,
1855
+ fee: 0.7386,
1856
+ tax: 0.33,
1857
+ },
1858
+ _id: '697a2d3b6b2789e04696c2d1',
1859
+ },
1860
+ {
1861
+ itemId: '68a0f4a7aa30dd1524162cea',
1862
+ categoryId: '68a0ea8359fd1012e3aaa823',
1863
+ name: 'Suit 2pcs',
1864
+ description: '',
1865
+ serial: null,
1866
+ serialRequired: null,
1867
+ sku: '06827465',
1868
+ price: 22,
1869
+ quantity: 1,
1870
+ pieces: 2,
1871
+ weight: 0,
1872
+ modifiers: [
1873
+ {
1874
+ modifierId: '68a1005bb49860bc58c2ce90',
1875
+ _parentId: null,
1876
+ locked: false,
1877
+ name: 'Prepay discount',
1878
+ sku: '',
1879
+ description: '',
1880
+ group: 'Discount',
1881
+ type: 'discount',
1882
+ attributes: [],
1883
+ cost: 0,
1884
+ tags: ['default'],
1885
+ order: 0,
1886
+ code: '',
1887
+ included: false,
1888
+ direct: true,
1889
+ hidden: false,
1890
+ print: true,
1891
+ required: false,
1892
+ recommended: false,
1893
+ default: true,
1894
+ addModifiers: [],
1895
+ delModifiers: [],
1896
+ conditions: {
1897
+ valid: false,
1898
+ rules: [
1899
+ {
1900
+ key: 'payment',
1901
+ operand: '$in',
1902
+ value: 'prepay',
1903
+ _id: '697a2d53a797183eb2482420',
1904
+ },
1905
+ ],
1906
+ _id: '697a2d53a797183eb248241f',
1907
+ },
1908
+ compute: {
1909
+ amount: 10,
1910
+ type: 'percentage',
1911
+ action: 'subtract',
1912
+ _id: '697a2d53a797183eb2482421',
1913
+ },
1914
+ properties: {
1915
+ override: null,
1916
+ sort: 3,
1917
+ isQuantityMultiplier: true,
1918
+ },
1919
+ _computed: {
1920
+ amount: 0,
1921
+ description: 'Prepay discount',
1922
+ },
1923
+ _hidden: false,
1924
+ _isDeleted: false,
1925
+ _id: '697a2d3a6b2789e04696c2cf',
1926
+ },
1927
+ {
1928
+ modifierId: '68a0eedba4582a7ef17e9a35',
1929
+ _parentId: null,
1930
+ locked: false,
1931
+ name: 'Dry Cleaning',
1932
+ sku: '',
1933
+ description: '',
1934
+ group: '',
1935
+ type: '',
1936
+ attributes: ['department'],
1937
+ cost: 0,
1938
+ tags: ['default', 'police'],
1939
+ order: 0,
1940
+ code: 'D',
1941
+ included: false,
1942
+ direct: true,
1943
+ hidden: false,
1944
+ print: false,
1945
+ required: true,
1946
+ recommended: false,
1947
+ default: false,
1948
+ addModifiers: [],
1949
+ delModifiers: [],
1950
+ conditions: {
1951
+ valid: true,
1952
+ rules: [],
1953
+ _id: '697a2d53a797183eb2482423',
1954
+ },
1955
+ compute: null,
1956
+ properties: {
1957
+ group: null,
1958
+ department: {
1959
+ tagSize: 'big',
1960
+ splitUnit: 'quantity',
1961
+ maxItems: '6',
1962
+ autoSplit: true,
1963
+ keepRelatedItems: true,
1964
+ },
1965
+ sort: null,
1966
+ },
1967
+ _computed: {
1968
+ amount: 0,
1969
+ description: 'Dry Cleaning',
1970
+ },
1971
+ _hidden: false,
1972
+ _isDeleted: false,
1973
+ _id: '697a2d3a6b2789e04696c2d0',
1974
+ },
1975
+ {
1976
+ modifierId: '69715ac9f3244a9a2cfda173',
1977
+ _parentId: null,
1978
+ locked: false,
1979
+ name: 'CASH 2% FEE',
1980
+ sku: '',
1981
+ description: '',
1982
+ group: 'Fee',
1983
+ type: 'fee',
1984
+ attributes: [],
1985
+ cost: 0,
1986
+ tags: ['default'],
1987
+ order: 0,
1988
+ code: '',
1989
+ included: false,
1990
+ direct: true,
1991
+ hidden: false,
1992
+ print: true,
1993
+ required: false,
1994
+ recommended: false,
1995
+ default: false,
1996
+ addModifiers: [],
1997
+ delModifiers: [],
1998
+ conditions: {
1999
+ valid: true,
2000
+ rules: [
2001
+ {
2002
+ key: 'paymentTypes',
2003
+ operand: '$in',
2004
+ value: ['cash'],
2005
+ _id: '697a2d53a797183eb2482426',
2006
+ },
2007
+ ],
2008
+ _id: '697a2d53a797183eb2482425',
2009
+ },
2010
+ compute: {
2011
+ amount: 2,
2012
+ type: 'percentage',
2013
+ action: 'add',
2014
+ _id: '697a2d53a797183eb2482427',
2015
+ },
2016
+ properties: {
2017
+ override: null,
2018
+ sort: 15,
2019
+ },
2020
+ _computed: {
2021
+ amount: 0,
2022
+ description: 'CASH 2% FEE',
2023
+ },
2024
+ _hidden: false,
2025
+ _isDeleted: false,
2026
+ _id: '697a2d3f6b2789e04696c2d6',
2027
+ },
2028
+ {
2029
+ modifierId: '696fe3f0be69c4c8316cf174',
2030
+ _parentId: '696fe3f0be69c4c8316cf174',
2031
+ locked: false,
2032
+ name: 'Modifier 30 days (Orders Ready Fee)',
2033
+ sku: '',
2034
+ description: '',
2035
+ group: 'Fee',
2036
+ type: 'fee',
2037
+ attributes: [],
2038
+ cost: 0,
2039
+ tags: ['default'],
2040
+ order: 0,
2041
+ code: '',
2042
+ included: false,
2043
+ direct: false,
2044
+ hidden: false,
2045
+ print: true,
2046
+ required: false,
2047
+ recommended: false,
2048
+ default: false,
2049
+ addModifiers: [],
2050
+ delModifiers: [],
2051
+ conditions: {
2052
+ valid: true,
2053
+ _id: '697a2e67a797183eb2483a23',
2054
+ rules: [],
2055
+ },
2056
+ compute: {
2057
+ amount: 2.2,
2058
+ type: 'fixed',
2059
+ action: 'add',
2060
+ _id: '697a2e67a797183eb2483a24',
2061
+ },
2062
+ properties: {
2063
+ override: null,
2064
+ sort: 4,
2065
+ isQuantityMultiplier: false,
2066
+ },
2067
+ _computed: {
2068
+ amount: 2.2,
2069
+ description: 'Modifier 30 days (Orders Ready Fee) ($2.20)',
2070
+ },
2071
+ _hidden: false,
2072
+ _isDeleted: false,
2073
+ _id: '697a2e66c18edb2f60f67730',
2074
+ },
2075
+ {
2076
+ modifierId: '68a10008a4582a7ef17eb3ec',
2077
+ _parentId: null,
2078
+ locked: false,
2079
+ name: 'Tax 5%',
2080
+ sku: '',
2081
+ description: '',
2082
+ group: 'Tax',
2083
+ type: 'tax',
2084
+ attributes: [],
2085
+ cost: 0,
2086
+ tags: ['default'],
2087
+ order: 0,
2088
+ code: '',
2089
+ included: false,
2090
+ direct: true,
2091
+ hidden: false,
2092
+ print: false,
2093
+ required: true,
2094
+ recommended: false,
2095
+ default: false,
2096
+ addModifiers: [],
2097
+ delModifiers: [],
2098
+ conditions: {
2099
+ valid: true,
2100
+ rules: [],
2101
+ _id: '697a2d53a797183eb248242c',
2102
+ },
2103
+ compute: {
2104
+ amount: 5,
2105
+ type: 'percentage',
2106
+ action: 'add',
2107
+ _id: '697a2d53a797183eb248242d',
2108
+ },
2109
+ properties: {
2110
+ override: null,
2111
+ sort: 5,
2112
+ isQuantityMultiplier: true,
2113
+ },
2114
+ _computed: {
2115
+ amount: 1.21,
2116
+ description: 'Tax 5% ($1.21)',
2117
+ },
2118
+ _hidden: false,
2119
+ _isDeleted: false,
2120
+ _id: '697a2d3a6b2789e04696c2ce',
2121
+ },
2122
+ {
2123
+ modifierId: '69715ac9f3244a9a2cfda173',
2124
+ _parentId: '697a2d3f6b2789e04696c2d6',
2125
+ locked: true,
2126
+ name: '$0.51 fee',
2127
+ sku: '',
2128
+ description: '',
2129
+ group: '',
2130
+ type: 'fee',
2131
+ attributes: [],
2132
+ cost: 0,
2133
+ tags: [],
2134
+ order: 0,
2135
+ code: '',
2136
+ included: false,
2137
+ direct: true,
2138
+ hidden: false,
2139
+ print: true,
2140
+ required: false,
2141
+ recommended: false,
2142
+ default: false,
2143
+ addModifiers: [],
2144
+ delModifiers: [],
2145
+ conditions: null,
2146
+ compute: {
2147
+ amount: 0.5082,
2148
+ type: 'fixed',
2149
+ action: 'add',
2150
+ _id: '697a2e67a797183eb2483a29',
2151
+ },
2152
+ properties: {
2153
+ isQuantityMultiplier: false,
2154
+ override: null,
2155
+ sort: 15,
2156
+ isCalculatedPaymentModifier: true,
2157
+ paymentId: '697a2e66a797183eb248397d',
2158
+ },
2159
+ _computed: {
2160
+ amount: 0.5082,
2161
+ description: '$0.51 fee ($0.51)',
2162
+ },
2163
+ _hidden: false,
2164
+ _isDeleted: false,
2165
+ _id: '697a2e66c18edb2f60f67734',
2166
+ },
2167
+ ],
2168
+ total: 25.92,
2169
+ totalPaid: 25.92,
2170
+ path: ',68a0ea81aa30dd1524162285,68a102cf59fd1012e3aaa974,',
2171
+ menuRuleId: '68a1034959fd1012e3aaa986',
2172
+ status: {
2173
+ picked: {
2174
+ value: true,
2175
+ date: '2026-01-28T15:42:25.026Z',
2176
+ },
2177
+ paid: {
2178
+ value: true,
2179
+ date: '2026-01-28T15:42:29.030Z',
2180
+ },
2181
+ tracker: [
2182
+ {
2183
+ date: '2026-01-28T15:42:26.881Z',
2184
+ location: 'Picked up',
2185
+ user: '68a0b1b7a4582a7ef17dd169',
2186
+ },
2187
+ ],
2188
+ },
2189
+ notes: [],
2190
+ subTotals: {
2191
+ _included: 0,
2192
+ _xincluded: 3.9182,
2193
+ _direct: 1.7182,
2194
+ _xdirect: 2.2,
2195
+ _simple: 22,
2196
+ _actual: 22,
2197
+ fee: 2.7082,
2198
+ tax: 1.21,
2199
+ },
2200
+ _id: '697a2d3a6b2789e04696c2cd',
2201
+ },
2202
+ {
2203
+ itemId: '68a0f5a9a4582a7ef17ea244',
2204
+ name: 'Jacket',
2205
+ description: '',
2206
+ serial: null,
2207
+ serialRequired: null,
2208
+ sku: '',
2209
+ price: 8.5,
2210
+ quantity: 1,
2211
+ pieces: 1,
2212
+ weight: 0,
2213
+ modifiers: [
2214
+ {
2215
+ modifierId: '68a0eedba4582a7ef17e9a35',
2216
+ _parentId: null,
2217
+ locked: false,
2218
+ name: 'Dry Cleaning',
2219
+ sku: '',
2220
+ description: '',
2221
+ group: '',
2222
+ type: '',
2223
+ attributes: ['department'],
2224
+ cost: 0,
2225
+ tags: ['default', 'police'],
2226
+ order: 0,
2227
+ code: 'D',
2228
+ included: false,
2229
+ direct: true,
2230
+ hidden: false,
2231
+ print: false,
2232
+ required: true,
2233
+ recommended: false,
2234
+ default: false,
2235
+ addModifiers: [],
2236
+ delModifiers: [],
2237
+ conditions: {
2238
+ valid: true,
2239
+ rules: [],
2240
+ _id: '697a2d53a797183eb2482430',
2241
+ },
2242
+ compute: null,
2243
+ properties: {
2244
+ group: null,
2245
+ department: {
2246
+ tagSize: 'big',
2247
+ splitUnit: 'quantity',
2248
+ maxItems: '6',
2249
+ autoSplit: true,
2250
+ keepRelatedItems: true,
2251
+ },
2252
+ sort: null,
2253
+ },
2254
+ _computed: {
2255
+ amount: 0,
2256
+ description: 'Dry Cleaning',
2257
+ },
2258
+ _hidden: false,
2259
+ _isDeleted: false,
2260
+ _id: '697a2d376b2789e04696c2ca',
2261
+ },
2262
+ {
2263
+ modifierId: '68a1005bb49860bc58c2ce90',
2264
+ _parentId: null,
2265
+ locked: false,
2266
+ name: 'Prepay discount',
2267
+ sku: '',
2268
+ description: '',
2269
+ group: 'Discount',
2270
+ type: 'discount',
2271
+ attributes: [],
2272
+ cost: 0,
2273
+ tags: ['default'],
2274
+ order: 0,
2275
+ code: '',
2276
+ included: false,
2277
+ direct: true,
2278
+ hidden: false,
2279
+ print: true,
2280
+ required: false,
2281
+ recommended: false,
2282
+ default: true,
2283
+ addModifiers: [],
2284
+ delModifiers: [],
2285
+ conditions: {
2286
+ valid: false,
2287
+ rules: [
2288
+ {
2289
+ key: 'payment',
2290
+ operand: '$in',
2291
+ value: 'prepay',
2292
+ _id: '697a2d53a797183eb2482433',
2293
+ },
2294
+ ],
2295
+ _id: '697a2d53a797183eb2482432',
2296
+ },
2297
+ compute: {
2298
+ amount: 10,
2299
+ type: 'percentage',
2300
+ action: 'subtract',
2301
+ _id: '697a2d53a797183eb2482434',
2302
+ },
2303
+ properties: {
2304
+ override: null,
2305
+ sort: 3,
2306
+ isQuantityMultiplier: true,
2307
+ },
2308
+ _computed: {
2309
+ amount: 0,
2310
+ description: 'Prepay discount',
2311
+ },
2312
+ _hidden: false,
2313
+ _isDeleted: false,
2314
+ _id: '697a2d376b2789e04696c2cc',
2315
+ },
2316
+ {
2317
+ modifierId: '69715ac9f3244a9a2cfda173',
2318
+ _parentId: null,
2319
+ locked: false,
2320
+ name: 'CASH 2% FEE',
2321
+ sku: '',
2322
+ description: '',
2323
+ group: 'Fee',
2324
+ type: 'fee',
2325
+ attributes: [],
2326
+ cost: 0,
2327
+ tags: ['default'],
2328
+ order: 0,
2329
+ code: '',
2330
+ included: false,
2331
+ direct: true,
2332
+ hidden: false,
2333
+ print: true,
2334
+ required: false,
2335
+ recommended: false,
2336
+ default: false,
2337
+ addModifiers: [],
2338
+ delModifiers: [],
2339
+ conditions: {
2340
+ valid: true,
2341
+ rules: [
2342
+ {
2343
+ key: 'paymentTypes',
2344
+ operand: '$in',
2345
+ value: ['cash'],
2346
+ _id: '697a2d53a797183eb2482437',
2347
+ },
2348
+ ],
2349
+ _id: '697a2d53a797183eb2482436',
2350
+ },
2351
+ compute: {
2352
+ amount: 2,
2353
+ type: 'percentage',
2354
+ action: 'add',
2355
+ _id: '697a2d53a797183eb2482438',
2356
+ },
2357
+ properties: {
2358
+ override: null,
2359
+ sort: 15,
2360
+ },
2361
+ _computed: {
2362
+ amount: 0,
2363
+ description: 'CASH 2% FEE',
2364
+ },
2365
+ _hidden: false,
2366
+ _isDeleted: false,
2367
+ _id: '697a2d416b2789e04696c2d7',
2368
+ },
2369
+ {
2370
+ modifierId: '696fe3f0be69c4c8316cf174',
2371
+ _parentId: '696fe3f0be69c4c8316cf174',
2372
+ locked: false,
2373
+ name: 'Modifier 30 days (Orders Ready Fee)',
2374
+ sku: '',
2375
+ description: '',
2376
+ group: 'Fee',
2377
+ type: 'fee',
2378
+ attributes: [],
2379
+ cost: 0,
2380
+ tags: ['default'],
2381
+ order: 0,
2382
+ code: '',
2383
+ included: false,
2384
+ direct: false,
2385
+ hidden: false,
2386
+ print: true,
2387
+ required: false,
2388
+ recommended: false,
2389
+ default: false,
2390
+ addModifiers: [],
2391
+ delModifiers: [],
2392
+ conditions: {
2393
+ valid: true,
2394
+ _id: '697a2e67a797183eb2483a36',
2395
+ rules: [],
2396
+ },
2397
+ compute: {
2398
+ amount: 0.85,
2399
+ type: 'fixed',
2400
+ action: 'add',
2401
+ _id: '697a2e67a797183eb2483a37',
2402
+ },
2403
+ properties: {
2404
+ override: null,
2405
+ sort: 4,
2406
+ isQuantityMultiplier: false,
2407
+ },
2408
+ _computed: {
2409
+ amount: 0.85,
2410
+ description: 'Modifier 30 days (Orders Ready Fee) ($0.85)',
2411
+ },
2412
+ _hidden: false,
2413
+ _isDeleted: false,
2414
+ _id: '697a2e66c18edb2f60f67731',
2415
+ },
2416
+ {
2417
+ modifierId: '68a10008a4582a7ef17eb3ec',
2418
+ _parentId: null,
2419
+ locked: false,
2420
+ name: 'Tax 5%',
2421
+ sku: '',
2422
+ description: '',
2423
+ group: 'Tax',
2424
+ type: 'tax',
2425
+ attributes: [],
2426
+ cost: 0,
2427
+ tags: ['default'],
2428
+ order: 0,
2429
+ code: '',
2430
+ included: false,
2431
+ direct: true,
2432
+ hidden: false,
2433
+ print: false,
2434
+ required: true,
2435
+ recommended: false,
2436
+ default: false,
2437
+ addModifiers: [],
2438
+ delModifiers: [],
2439
+ conditions: {
2440
+ valid: true,
2441
+ rules: [],
2442
+ _id: '697a2d53a797183eb248243d',
2443
+ },
2444
+ compute: {
2445
+ amount: 5,
2446
+ type: 'percentage',
2447
+ action: 'add',
2448
+ _id: '697a2d53a797183eb248243e',
2449
+ },
2450
+ properties: {
2451
+ override: null,
2452
+ sort: 5,
2453
+ isQuantityMultiplier: true,
2454
+ },
2455
+ _computed: {
2456
+ amount: 0.4675,
2457
+ description: 'Tax 5% ($0.47)',
2458
+ },
2459
+ _hidden: false,
2460
+ _isDeleted: false,
2461
+ _id: '697a2d376b2789e04696c2cb',
2462
+ },
2463
+ {
2464
+ modifierId: '69715ac9f3244a9a2cfda173',
2465
+ _parentId: '697a2d416b2789e04696c2d7',
2466
+ locked: true,
2467
+ name: '$0.20 fee',
2468
+ sku: '',
2469
+ description: '',
2470
+ group: '',
2471
+ type: 'fee',
2472
+ attributes: [],
2473
+ cost: 0,
2474
+ tags: [],
2475
+ order: 0,
2476
+ code: '',
2477
+ included: false,
2478
+ direct: true,
2479
+ hidden: false,
2480
+ print: true,
2481
+ required: false,
2482
+ recommended: false,
2483
+ default: false,
2484
+ addModifiers: [],
2485
+ delModifiers: [],
2486
+ conditions: null,
2487
+ compute: {
2488
+ amount: 0.19635,
2489
+ type: 'fixed',
2490
+ action: 'add',
2491
+ _id: '697a2e67a797183eb2483a3c',
2492
+ },
2493
+ properties: {
2494
+ isQuantityMultiplier: false,
2495
+ override: null,
2496
+ sort: 15,
2497
+ isCalculatedPaymentModifier: true,
2498
+ paymentId: '697a2e66a797183eb248397d',
2499
+ },
2500
+ _computed: {
2501
+ amount: 0.19635,
2502
+ description: '$0.20 fee ($0.20)',
2503
+ },
2504
+ _hidden: false,
2505
+ _isDeleted: false,
2506
+ _id: '697a2e66c18edb2f60f67735',
2507
+ },
2508
+ ],
2509
+ total: 10.01,
2510
+ totalPaid: 10.01,
2511
+ path: ',68a0ea81aa30dd1524162285,68a102e959fd1012e3aaa97e,',
2512
+ menuRuleId: '68a1037d59fd1012e3aaa98c',
2513
+ status: {
2514
+ picked: {
2515
+ value: true,
2516
+ date: '2026-01-28T15:42:25.026Z',
2517
+ },
2518
+ paid: {
2519
+ value: true,
2520
+ date: '2026-01-28T15:42:29.030Z',
2521
+ },
2522
+ tracker: [
2523
+ {
2524
+ date: '2026-01-28T15:42:26.881Z',
2525
+ location: 'Picked up',
2526
+ user: '68a0b1b7a4582a7ef17dd169',
2527
+ },
2528
+ ],
2529
+ },
2530
+ notes: [],
2531
+ subTotals: {
2532
+ _included: 0,
2533
+ _xincluded: 1.51385,
2534
+ _direct: 0.66385,
2535
+ _xdirect: 0.85,
2536
+ _simple: 8.5,
2537
+ _actual: 8.5,
2538
+ fee: 1.04635,
2539
+ tax: 0.4675,
2540
+ },
2541
+ _id: '697a2d376b2789e04696c2c9',
2542
+ },
2543
+ {
2544
+ itemId: '68a0f5feaa30dd15241630e1',
2545
+ name: 'Coat',
2546
+ description: '',
2547
+ serial: null,
2548
+ serialRequired: null,
2549
+ sku: '',
2550
+ price: 13,
2551
+ quantity: 1,
2552
+ pieces: 1,
2553
+ weight: 0,
2554
+ modifiers: [
2555
+ {
2556
+ modifierId: '68a0eedba4582a7ef17e9a35',
2557
+ _parentId: null,
2558
+ locked: false,
2559
+ name: 'Dry Cleaning',
2560
+ sku: '',
2561
+ description: '',
2562
+ group: '',
2563
+ type: '',
2564
+ attributes: ['department'],
2565
+ cost: 0,
2566
+ tags: ['default', 'police'],
2567
+ order: 0,
2568
+ code: 'D',
2569
+ included: false,
2570
+ direct: true,
2571
+ hidden: false,
2572
+ print: false,
2573
+ required: true,
2574
+ recommended: false,
2575
+ default: false,
2576
+ addModifiers: [],
2577
+ delModifiers: [],
2578
+ conditions: {
2579
+ valid: true,
2580
+ rules: [],
2581
+ _id: '697a2d53a797183eb2482441',
2582
+ },
2583
+ compute: null,
2584
+ properties: {
2585
+ group: null,
2586
+ department: {
2587
+ tagSize: 'big',
2588
+ splitUnit: 'quantity',
2589
+ maxItems: '6',
2590
+ autoSplit: true,
2591
+ keepRelatedItems: true,
2592
+ },
2593
+ sort: null,
2594
+ },
2595
+ _computed: {
2596
+ amount: 0,
2597
+ description: 'Dry Cleaning',
2598
+ },
2599
+ _hidden: false,
2600
+ _isDeleted: false,
2601
+ _id: '697a2d366b2789e04696c2c6',
2602
+ },
2603
+ {
2604
+ modifierId: '68a1005bb49860bc58c2ce90',
2605
+ _parentId: null,
2606
+ locked: false,
2607
+ name: 'Prepay discount',
2608
+ sku: '',
2609
+ description: '',
2610
+ group: 'Discount',
2611
+ type: 'discount',
2612
+ attributes: [],
2613
+ cost: 0,
2614
+ tags: ['default'],
2615
+ order: 0,
2616
+ code: '',
2617
+ included: false,
2618
+ direct: true,
2619
+ hidden: false,
2620
+ print: true,
2621
+ required: false,
2622
+ recommended: false,
2623
+ default: true,
2624
+ addModifiers: [],
2625
+ delModifiers: [],
2626
+ conditions: {
2627
+ valid: false,
2628
+ rules: [
2629
+ {
2630
+ key: 'payment',
2631
+ operand: '$in',
2632
+ value: 'prepay',
2633
+ _id: '697a2d53a797183eb2482444',
2634
+ },
2635
+ ],
2636
+ _id: '697a2d53a797183eb2482443',
2637
+ },
2638
+ compute: {
2639
+ amount: 10,
2640
+ type: 'percentage',
2641
+ action: 'subtract',
2642
+ _id: '697a2d53a797183eb2482445',
2643
+ },
2644
+ properties: {
2645
+ override: null,
2646
+ sort: 3,
2647
+ isQuantityMultiplier: true,
2648
+ },
2649
+ _computed: {
2650
+ amount: 0,
2651
+ description: 'Prepay discount',
2652
+ },
2653
+ _hidden: false,
2654
+ _isDeleted: false,
2655
+ _id: '697a2d366b2789e04696c2c8',
2656
+ },
2657
+ {
2658
+ modifierId: '69715ac9f3244a9a2cfda173',
2659
+ _parentId: null,
2660
+ locked: false,
2661
+ name: 'CASH 2% FEE',
2662
+ sku: '',
2663
+ description: '',
2664
+ group: 'Fee',
2665
+ type: 'fee',
2666
+ attributes: [],
2667
+ cost: 0,
2668
+ tags: ['default'],
2669
+ order: 0,
2670
+ code: '',
2671
+ included: false,
2672
+ direct: true,
2673
+ hidden: false,
2674
+ print: true,
2675
+ required: false,
2676
+ recommended: false,
2677
+ default: false,
2678
+ addModifiers: [],
2679
+ delModifiers: [],
2680
+ conditions: {
2681
+ valid: true,
2682
+ rules: [
2683
+ {
2684
+ key: 'paymentTypes',
2685
+ operand: '$in',
2686
+ value: ['cash'],
2687
+ _id: '697a2d53a797183eb2482448',
2688
+ },
2689
+ ],
2690
+ _id: '697a2d53a797183eb2482447',
2691
+ },
2692
+ compute: {
2693
+ amount: 2,
2694
+ type: 'percentage',
2695
+ action: 'add',
2696
+ _id: '697a2d53a797183eb2482449',
2697
+ },
2698
+ properties: {
2699
+ override: null,
2700
+ sort: 15,
2701
+ },
2702
+ _computed: {
2703
+ amount: 0,
2704
+ description: 'CASH 2% FEE',
2705
+ },
2706
+ _hidden: false,
2707
+ _isDeleted: false,
2708
+ _id: '697a2d436b2789e04696c2d8',
2709
+ },
2710
+ {
2711
+ modifierId: '696fe3f0be69c4c8316cf174',
2712
+ _parentId: '696fe3f0be69c4c8316cf174',
2713
+ locked: false,
2714
+ name: 'Modifier 30 days (Orders Ready Fee)',
2715
+ sku: '',
2716
+ description: '',
2717
+ group: 'Fee',
2718
+ type: 'fee',
2719
+ attributes: [],
2720
+ cost: 0,
2721
+ tags: ['default'],
2722
+ order: 0,
2723
+ code: '',
2724
+ included: false,
2725
+ direct: false,
2726
+ hidden: false,
2727
+ print: true,
2728
+ required: false,
2729
+ recommended: false,
2730
+ default: false,
2731
+ addModifiers: [],
2732
+ delModifiers: [],
2733
+ conditions: {
2734
+ valid: true,
2735
+ _id: '697a2e67a797183eb2483a49',
2736
+ rules: [],
2737
+ },
2738
+ compute: {
2739
+ amount: 1.3,
2740
+ type: 'fixed',
2741
+ action: 'add',
2742
+ _id: '697a2e67a797183eb2483a4a',
2743
+ },
2744
+ properties: {
2745
+ override: null,
2746
+ sort: 4,
2747
+ isQuantityMultiplier: false,
2748
+ },
2749
+ _computed: {
2750
+ amount: 1.3,
2751
+ description: 'Modifier 30 days (Orders Ready Fee) ($1.30)',
2752
+ },
2753
+ _hidden: false,
2754
+ _isDeleted: false,
2755
+ _id: '697a2e66c18edb2f60f67732',
2756
+ },
2757
+ {
2758
+ modifierId: '68a10008a4582a7ef17eb3ec',
2759
+ _parentId: null,
2760
+ locked: false,
2761
+ name: 'Tax 5%',
2762
+ sku: '',
2763
+ description: '',
2764
+ group: 'Tax',
2765
+ type: 'tax',
2766
+ attributes: [],
2767
+ cost: 0,
2768
+ tags: ['default'],
2769
+ order: 0,
2770
+ code: '',
2771
+ included: false,
2772
+ direct: true,
2773
+ hidden: false,
2774
+ print: false,
2775
+ required: true,
2776
+ recommended: false,
2777
+ default: false,
2778
+ addModifiers: [],
2779
+ delModifiers: [],
2780
+ conditions: {
2781
+ valid: true,
2782
+ rules: [],
2783
+ _id: '697a2d53a797183eb248244e',
2784
+ },
2785
+ compute: {
2786
+ amount: 5,
2787
+ type: 'percentage',
2788
+ action: 'add',
2789
+ _id: '697a2d53a797183eb248244f',
2790
+ },
2791
+ properties: {
2792
+ override: null,
2793
+ sort: 5,
2794
+ isQuantityMultiplier: true,
2795
+ },
2796
+ _computed: {
2797
+ amount: 0.715,
2798
+ description: 'Tax 5% ($0.72)',
2799
+ },
2800
+ _hidden: false,
2801
+ _isDeleted: false,
2802
+ _id: '697a2d366b2789e04696c2c7',
2803
+ },
2804
+ {
2805
+ modifierId: '69715ac9f3244a9a2cfda173',
2806
+ _parentId: '697a2d436b2789e04696c2d8',
2807
+ locked: true,
2808
+ name: '$0.30 fee',
2809
+ sku: '',
2810
+ description: '',
2811
+ group: '',
2812
+ type: 'fee',
2813
+ attributes: [],
2814
+ cost: 0,
2815
+ tags: [],
2816
+ order: 0,
2817
+ code: '',
2818
+ included: false,
2819
+ direct: true,
2820
+ hidden: false,
2821
+ print: true,
2822
+ required: false,
2823
+ recommended: false,
2824
+ default: false,
2825
+ addModifiers: [],
2826
+ delModifiers: [],
2827
+ conditions: null,
2828
+ compute: {
2829
+ amount: 0.3003,
2830
+ type: 'fixed',
2831
+ action: 'add',
2832
+ _id: '697a2e67a797183eb2483a4f',
2833
+ },
2834
+ properties: {
2835
+ isQuantityMultiplier: false,
2836
+ override: null,
2837
+ sort: 15,
2838
+ isCalculatedPaymentModifier: true,
2839
+ paymentId: '697a2e66a797183eb248397d',
2840
+ },
2841
+ _computed: {
2842
+ amount: 0.3003,
2843
+ description: '$0.30 fee ($0.30)',
2844
+ },
2845
+ _hidden: false,
2846
+ _isDeleted: false,
2847
+ _id: '697a2e66c18edb2f60f67736',
2848
+ },
2849
+ ],
2850
+ total: 15.32,
2851
+ totalPaid: 15.31,
2852
+ path: ',68a0ea81aa30dd1524162285,68a102e959fd1012e3aaa97b,',
2853
+ menuRuleId: '68a1039559fd1012e3aaa98e',
2854
+ status: {
2855
+ picked: {
2856
+ value: true,
2857
+ date: '2026-01-28T15:42:25.026Z',
2858
+ },
2859
+ paid: {
2860
+ value: false,
2861
+ date: '2026-01-28T15:42:29.030Z',
2862
+ },
2863
+ tracker: [
2864
+ {
2865
+ date: '2026-01-28T15:42:26.881Z',
2866
+ location: 'Picked up',
2867
+ user: '68a0b1b7a4582a7ef17dd169',
2868
+ },
2869
+ ],
2870
+ },
2871
+ notes: [],
2872
+ subTotals: {
2873
+ _included: 0,
2874
+ _xincluded: 2.3153,
2875
+ _direct: 1.0153,
2876
+ _xdirect: 1.3,
2877
+ _simple: 13,
2878
+ _actual: 13,
2879
+ fee: 1.6003,
2880
+ tax: 0.715,
2881
+ },
2882
+ _id: '697a2d366b2789e04696c2c5',
2883
+ },
2884
+ ],
2885
+ subTotal: 49.5,
2886
+ total: 58.32,
2887
+ totalPaid: 58.31,
2888
+ modifiers: [
2889
+ {
2890
+ modifierId: null,
2891
+ _parentId: null,
2892
+ locked: false,
2893
+ name: 'Modifier 30 days (Orders Ready Fee)',
2894
+ sku: '',
2895
+ description: '',
2896
+ group: 'Fee',
2897
+ type: 'fee',
2898
+ attributes: [],
2899
+ cost: 0,
2900
+ tags: ['default'],
2901
+ order: 0,
2902
+ code: '',
2903
+ included: false,
2904
+ direct: true,
2905
+ hidden: false,
2906
+ print: true,
2907
+ required: false,
2908
+ recommended: false,
2909
+ default: false,
2910
+ addModifiers: [],
2911
+ delModifiers: [],
2912
+ conditions: null,
2913
+ compute: {
2914
+ amount: 10,
2915
+ type: 'percentage',
2916
+ action: 'add',
2917
+ _id: '697a2d53a797183eb2482451',
2918
+ },
2919
+ properties: {
2920
+ override: null,
2921
+ sort: 4,
2922
+ },
2923
+ _computed: null,
2924
+ _hidden: false,
2925
+ _isDeleted: false,
2926
+ _id: '696fe3f0be69c4c8316cf174',
2927
+ },
2928
+ ],
2929
+ displayId: '615-1',
2930
+ description: '',
2931
+ type: '',
2932
+ notes: [],
2933
+ status: {
2934
+ order: 'open',
2935
+ delivery: false,
2936
+ detailed: true,
2937
+ paid: false,
2938
+ picked: true,
2939
+ tracker: [
2940
+ {
2941
+ date: '2026-01-28T15:37:58.245Z',
2942
+ location: 'In Progress',
2943
+ user: '68a0b1b7a4582a7ef17dd169',
2944
+ },
2945
+ {
2946
+ date: '2026-01-28T15:42:26.881Z',
2947
+ location: 'Picked up',
2948
+ user: '68a0b1b7a4582a7ef17dd169',
2949
+ },
2950
+ ],
2951
+ invoice: 'partial',
2952
+ },
2953
+ attributes: [],
2954
+ properties: {
2955
+ pieceCount: 5,
2956
+ split: 'auto',
2957
+ },
2958
+ subTotals: {
2959
+ fee: 6.09345,
2960
+ tax: 2.7225,
2961
+ },
2962
+ start: {
2963
+ location: {
2964
+ name: 'Clean Show 2025',
2965
+ locationType: 'store',
2966
+ storeId: '68a0b1b7f53773001282b971',
2967
+ },
2968
+ },
2969
+ end: {
2970
+ location: {
2971
+ name: 'Clean Show 2025',
2972
+ locationType: 'store',
2973
+ storeId: '68a0b1b7f53773001282b971',
2974
+ },
2975
+ },
2976
+ _accountId: '68a0b1b7aa30dd1524152178',
2977
+ _storeId: '68a0b1b7f53773001282b971',
2978
+ _isDeleted: false,
2979
+ parentItems: [],
2980
+ };
2981
+
2982
+ const cashPercentageDiscountOrder = pricingService.order.calculate(order, {
2983
+ paymentType: 'cash',
2984
+ });
2985
+
2986
+ expect(cashPercentageDiscountOrder.total).toBe(58.32);
2987
+ });
2988
+ test('Should calculate order that was partially paid using a payment modifier (Fee)', () => {
2989
+ const order = {
2990
+ _id: '5c79661964a4b8470cc25e45',
2991
+ customer: '5c73d50b213453368dd30422',
2992
+ user: '5a09fd650cd56e741f78aba6',
2993
+ items: [
2994
+ {
2995
+ _id: '68a0f6dca4582a7ef17ea80b',
2996
+ itemId: '68a0f6dca4582a7ef17ea70b',
2997
+ name: 'Simple Item',
2998
+ price: 10,
2999
+ quantity: 1,
3000
+ total: 10.55,
3001
+ totalPaid: 5.5,
3002
+ status: {
3003
+ picked: {
3004
+ value: false,
3005
+ },
3006
+ paid: {
3007
+ value: false,
3008
+ date: '2026-01-28T22:57:27.265Z',
3009
+ },
3010
+ tracker: [],
3011
+ },
3012
+ modifiers: [
3013
+ {
3014
+ _id: '5e3dc254dd00998433be26e4',
3015
+ modifierId: '5e3dc254dd00998433be26e5',
3016
+ name: 'Cash 10% Fee',
3017
+ group: 'Fee',
3018
+ type: 'fee',
3019
+ direct: true,
3020
+ conditions: {
3021
+ valid: true,
3022
+ rules: [
3023
+ {
3024
+ key: 'paymentTypes',
3025
+ operand: '$in',
3026
+ value: ['cash'],
3027
+ },
3028
+ ],
3029
+ },
3030
+ compute: {
3031
+ amount: 10,
3032
+ type: 'percentage',
3033
+ action: 'add',
3034
+ },
3035
+ _computed: {
3036
+ amount: 0,
3037
+ description: 'Cash 10% Fee',
3038
+ },
3039
+ },
3040
+ {
3041
+ name: '$0.55 fee',
3042
+ sku: '',
3043
+ description: '',
3044
+ group: '',
3045
+ type: 'fee',
3046
+ attributes: [],
3047
+ color: '',
3048
+ backgroundColor: '',
3049
+ icon: '',
3050
+ url: '',
3051
+ code: '',
3052
+ tags: [],
3053
+ order: 0,
3054
+ included: false,
3055
+ direct: true,
3056
+ hidden: false,
3057
+ required: false,
3058
+ print: true,
3059
+ delModifiers: [],
3060
+ addModifiers: [],
3061
+ conditions: null,
3062
+ compute: {
3063
+ action: 'add',
3064
+ amount: 0.55,
3065
+ type: 'fixed',
3066
+ },
3067
+ properties: {
3068
+ isQuantityMultiplier: false,
3069
+ isCalculatedPaymentModifier: true,
3070
+ paymentId: '697a94579599f8e7e651c8cf',
3071
+ },
3072
+ _id: '697a9457bbc0dbec5817d606',
3073
+ modifierId: '5e3dc254dd00998433be26e5',
3074
+ __typename: 'Modifier',
3075
+ _parentId: '5e3dc254dd00998433be26e4',
3076
+ _computed: {
3077
+ amount: 0.55,
3078
+ description: '$0.55 fee ($0.55)',
3079
+ },
3080
+ locked: true,
3081
+ },
3082
+ ],
3083
+ subTotals: {
3084
+ _included: 0,
3085
+ _xincluded: 0.55,
3086
+ _direct: 0.55,
3087
+ _xdirect: 0,
3088
+ _simple: 10,
3089
+ _actual: 10,
3090
+ fee: 0.55,
3091
+ },
3092
+ picked: {
3093
+ value: false,
3094
+ },
3095
+ paid: {
3096
+ value: false,
3097
+ date: '2026-01-28T22:57:27.265Z',
3098
+ },
3099
+ tracker: [],
3100
+ },
3101
+ ],
3102
+ subTotal: 10,
3103
+ total: 10.55,
3104
+ totalPaid: 5.5,
3105
+ status: {
3106
+ order: 'open',
3107
+ paid: false,
3108
+ picked: false,
3109
+ },
3110
+ _storeId: '59c042222a985ae70278619f',
3111
+ _accountId: '59c00b5eee5263d3b064283d',
3112
+ _isDeleted: false,
3113
+ subTotals: {
3114
+ fee: 0.55,
3115
+ },
3116
+ properties: {
3117
+ pieceCount: 0,
3118
+ },
3119
+ };
3120
+
3121
+ const resultWithoutPaymentMods = pricingService.order.calculate(order);
3122
+
3123
+ expect(resultWithoutPaymentMods.total).toBe(10.55);
3124
+ expect(
3125
+ pricingService.order.getBalance({ order: resultWithoutPaymentMods })
3126
+ ).toBe(5.05);
3127
+
3128
+ const resultWithPaymentMods = pricingService.order.calculate(order, {
3129
+ paymentType: 'cash',
3130
+ });
3131
+
3132
+ expect(resultWithPaymentMods.total).toBe(11);
3133
+ expect(resultWithPaymentMods.items[0].total).toBe(11);
3134
+ expect(resultWithPaymentMods.items[0].modifiers.length).toBe(3);
3135
+
3136
+ expect(resultWithPaymentMods.items[0].modifiers[0]).toMatchObject({
3137
+ name: 'Cash 10% Fee',
3138
+ _computed: {
3139
+ amount: 0,
3140
+ },
3141
+ conditions: { valid: true },
3142
+ });
3143
+ expect(resultWithPaymentMods.items[0].modifiers[1]).toMatchObject({
3144
+ name: '$0.45 fee',
3145
+
3146
+ _computed: {
3147
+ amount: 0.45,
3148
+ },
3149
+ });
3150
+ expect(resultWithPaymentMods.items[0].modifiers[2]).toMatchObject({
3151
+ name: '$0.55 fee',
3152
+
3153
+ _computed: {
3154
+ amount: 0.55,
3155
+ },
3156
+ });
3157
+
3158
+ expect(
3159
+ pricingService.order.getBalance({ order: resultWithPaymentMods })
3160
+ ).toBe(5.5);
3161
+ });
3162
+
3163
+ test('Should calculate order that was partially paid using a payment modifier (Discount)', () => {
3164
+ const order = {
3165
+ _id: '5c79661964a4b8470cc25e46',
3166
+ customer: '5c73d50b213453368dd30422',
3167
+ user: '5a09fd650cd56e741f78aba6',
3168
+ items: [
3169
+ {
3170
+ _id: '68a0f6dca4582a7ef17ea80c',
3171
+ itemId: '68a0f6dca4582a7ef17ea70b',
3172
+ name: 'Simple Item',
3173
+ price: 10,
3174
+ quantity: 1,
3175
+ total: 9.44,
3176
+ totalPaid: 5,
3177
+ status: {
3178
+ picked: {
3179
+ value: false,
3180
+ },
3181
+ paid: {
3182
+ value: false,
3183
+ date: '2026-01-29T15:33:40.280Z',
3184
+ },
3185
+ tracker: [],
3186
+ },
3187
+ modifiers: [
3188
+ {
3189
+ _id: '5e3dc254dd00998433be26e6',
3190
+ modifierId: '5e3dc254dd00998433be26e7',
3191
+ name: 'Cash 10% Discount',
3192
+ group: 'Discount',
3193
+ type: 'discount',
3194
+ direct: true,
3195
+ conditions: {
3196
+ valid: true,
3197
+ rules: [
3198
+ {
3199
+ key: 'paymentTypes',
3200
+ operand: '$in',
3201
+ value: ['cash'],
3202
+ },
3203
+ ],
3204
+ },
3205
+ compute: {
3206
+ amount: 10,
3207
+ type: 'percentage',
3208
+ action: 'subtract',
3209
+ },
3210
+ _computed: {
3211
+ amount: 0,
3212
+ description: 'Cash 10% Discount',
3213
+ },
3214
+ },
3215
+ {
3216
+ name: '$0.56 discount',
3217
+ sku: '',
3218
+ description: '',
3219
+ group: '',
3220
+ type: 'discount',
3221
+ attributes: [],
3222
+ color: '',
3223
+ backgroundColor: '',
3224
+ icon: '',
3225
+ url: '',
3226
+ code: '',
3227
+ tags: [],
3228
+ order: 0,
3229
+ included: false,
3230
+ direct: true,
3231
+ hidden: false,
3232
+ required: false,
3233
+ print: true,
3234
+ delModifiers: [],
3235
+ addModifiers: [],
3236
+ conditions: null,
3237
+ compute: {
3238
+ action: 'subtract',
3239
+ amount: 0.555555555555555,
3240
+ type: 'fixed',
3241
+ },
3242
+ properties: {
3243
+ isCalculatedPaymentModifier: true,
3244
+ paymentId: '697b7dd46c334ac52e1bd631',
3245
+ },
3246
+ _id: '697b7dd43463ae54e2f6792d',
3247
+ modifierId: '5e3dc254dd00998433be26e7',
3248
+ __typename: 'Modifier',
3249
+ _parentId: '5e3dc254dd00998433be26e6',
3250
+ _computed: {
3251
+ amount: -0.555555555555555,
3252
+ description: '$0.56 discount (-$0.56)',
3253
+ },
3254
+ locked: true,
3255
+ },
3256
+ ],
3257
+ subTotals: {
3258
+ _included: 0,
3259
+ _xincluded: -0.555555555555555,
3260
+ _direct: -0.555555555555555,
3261
+ _xdirect: 0,
3262
+ _simple: 10,
3263
+ _actual: 10,
3264
+ discount: -0.555555555555555,
3265
+ },
3266
+ picked: {
3267
+ value: false,
3268
+ },
3269
+ paid: {
3270
+ value: false,
3271
+ date: '2026-01-29T15:33:40.280Z',
3272
+ },
3273
+ tracker: [],
3274
+ },
3275
+ ],
3276
+ subTotal: 10,
3277
+ total: 9.44,
3278
+ totalPaid: 5,
3279
+ status: {
3280
+ order: 'open',
3281
+ paid: false,
3282
+ picked: false,
3283
+ },
3284
+ _storeId: '59c042222a985ae70278619f',
3285
+ _accountId: '59c00b5eee5263d3b064283d',
3286
+ _isDeleted: false,
3287
+ subTotals: {
3288
+ discount: -0.555555555555555,
3289
+ },
3290
+ properties: {
3291
+ pieceCount: 0,
3292
+ },
3293
+ };
3294
+
3295
+ const resultWithoutPaymentMods = pricingService.order.calculate(order);
3296
+
3297
+ expect(resultWithoutPaymentMods.total).toBe(9.44);
3298
+ expect(
3299
+ pricingService.order.getBalance({ order: resultWithoutPaymentMods })
3300
+ ).toBe(4.44);
3301
+
3302
+ const resultWithPaymentMods = pricingService.order.calculate(order, {
3303
+ paymentType: 'cash',
3304
+ });
3305
+
3306
+ expect(resultWithPaymentMods.total).toBe(9);
3307
+ expect(resultWithPaymentMods.items[0].total).toBe(9);
3308
+ expect(resultWithPaymentMods.items[0].modifiers.length).toBe(3);
3309
+
3310
+ expect(resultWithPaymentMods.items[0].modifiers[0]).toMatchObject({
3311
+ name: 'Cash 10% Discount',
3312
+ _computed: {
3313
+ amount: 0,
3314
+ },
3315
+ conditions: { valid: true },
3316
+ });
3317
+ expect(resultWithPaymentMods.items[0].modifiers[1]).toMatchObject({
3318
+ name: '$0.44 discount',
3319
+
3320
+ _computed: {
3321
+ amount: -0.444,
3322
+ },
3323
+ });
3324
+ expect(resultWithPaymentMods.items[0].modifiers[2]).toMatchObject({
3325
+ name: '$0.56 discount',
3326
+
3327
+ _computed: {
3328
+ amount: -0.555555555555555,
3329
+ },
3330
+ });
3331
+
3332
+ expect(
3333
+ pricingService.order.getBalance({ order: resultWithPaymentMods })
3334
+ ).toBe(4);
3335
+ });
1503
3336
  });