@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.
- package/__TEST__/modifier/getMatchTagsModifiers.test.js +6 -6
- package/__TEST__/modifier/hasMatchTags.test.js +2 -2
- package/__TEST__/order/order-payment-modifier.test.js +1845 -12
- package/__TEST__/order/order.test.js +888 -4
- package/lib/index.js +11 -0
- package/lib/invoice/getStatusByItems.js +22 -0
- package/lib/invoice/getTotalByItems.js +12 -0
- package/lib/invoice/index.js +24 -0
- package/lib/item/applyPayment.js +22 -0
- package/lib/item/calculate.js +13 -7
- package/lib/item/getAmountToPayById.js +6 -0
- package/lib/item/getBalanceForPaymentModifier.js +30 -0
- package/lib/item/getPaidStatus.js +29 -0
- package/lib/item/index.js +8 -2
- package/lib/item/patchItem.js +3 -1
- package/lib/modifier/hasMatchTags.js +1 -18
- package/lib/modifier/patchModifier.js +4 -0
- package/lib/order/calculate.js +47 -3
- package/lib/order/calculateWithPayment.js +36 -0
- package/lib/order/getPaidStatus.js +35 -0
- package/lib/order/getPickedStatus.js +4 -0
- package/lib/order/index.js +6 -2
- package/lib/order/updatePaidStatus.js +0 -0
- package/package.json +4 -3
- package/lib/item/getUpdatedStatus.js +0 -17
- package/lib/order/getUpdatedStatus.js +0 -17
|
@@ -58,7 +58,7 @@ describe('GetMatchTagsModifiers Function', () => {
|
|
|
58
58
|
modifiers,
|
|
59
59
|
entity: customer,
|
|
60
60
|
})
|
|
61
|
-
).toHaveLength(
|
|
61
|
+
).toHaveLength(1);
|
|
62
62
|
modifiers = [{ tags: ['test'] }];
|
|
63
63
|
expect(
|
|
64
64
|
pricingService.modifier.getMatchTagsModifiers({
|
|
@@ -79,7 +79,7 @@ describe('GetMatchTagsModifiers Function', () => {
|
|
|
79
79
|
modifiers,
|
|
80
80
|
entity: customer,
|
|
81
81
|
})
|
|
82
|
-
).toHaveLength(
|
|
82
|
+
).toHaveLength(2);
|
|
83
83
|
modifiers = [
|
|
84
84
|
{ tags: ['all'] },
|
|
85
85
|
{ tags: ['test'] },
|
|
@@ -91,7 +91,7 @@ describe('GetMatchTagsModifiers Function', () => {
|
|
|
91
91
|
modifiers,
|
|
92
92
|
entity: customer,
|
|
93
93
|
})
|
|
94
|
-
).toHaveLength(
|
|
94
|
+
).toHaveLength(2);
|
|
95
95
|
modifiers = [
|
|
96
96
|
{ tags: ['all'] },
|
|
97
97
|
{ tags: ['test'] },
|
|
@@ -104,7 +104,7 @@ describe('GetMatchTagsModifiers Function', () => {
|
|
|
104
104
|
modifiers,
|
|
105
105
|
entity: customer,
|
|
106
106
|
})
|
|
107
|
-
).toHaveLength(
|
|
107
|
+
).toHaveLength(3);
|
|
108
108
|
modifiers = [{ tags: ['all'] }];
|
|
109
109
|
expect(
|
|
110
110
|
pricingService.modifier.getMatchTagsModifiers({
|
|
@@ -130,7 +130,7 @@ describe('GetMatchTagsModifiers Function', () => {
|
|
|
130
130
|
modifiers,
|
|
131
131
|
entity: customer,
|
|
132
132
|
})
|
|
133
|
-
).toHaveLength(
|
|
133
|
+
).toHaveLength(3);
|
|
134
134
|
customer.tags = ['all'];
|
|
135
135
|
expect(
|
|
136
136
|
pricingService.modifier.getMatchTagsModifiers({
|
|
@@ -158,6 +158,6 @@ describe('GetMatchTagsModifiers Function', () => {
|
|
|
158
158
|
modifiers,
|
|
159
159
|
entity: customer,
|
|
160
160
|
})
|
|
161
|
-
).toHaveLength(
|
|
161
|
+
).toHaveLength(6);
|
|
162
162
|
});
|
|
163
163
|
});
|
|
@@ -31,9 +31,9 @@ describe('Has Match Tags Function', () => {
|
|
|
31
31
|
);
|
|
32
32
|
customer.tags = ['test'];
|
|
33
33
|
modifier.tags = ['test'];
|
|
34
|
-
expect(pricingService.modifier.hasMatchTags(customer)).toBe(
|
|
34
|
+
expect(pricingService.modifier.hasMatchTags(customer)).toBe(true);
|
|
35
35
|
expect(pricingService.modifier.hasMatchTags(undefined, modifier)).toBe(
|
|
36
|
-
|
|
36
|
+
true
|
|
37
37
|
);
|
|
38
38
|
customer.tags = ['test'];
|
|
39
39
|
modifier.tags = ['all'];
|