@darkpos/pricing 1.0.171 → 1.0.173
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/README.md +2 -5
- package/__TEST__/invoice.test.js +5 -1
- package/__TEST__/item/getModifierTags.test.js +1 -1
- package/__TEST__/item/unpick.item.test.js +2 -0
- package/__TEST__/item.test.js +2 -0
- package/__TEST__/mocks/storeSettings.js +427 -0
- package/__TEST__/mocks/stores.js +0 -429
- package/__TEST__/modifier/addItemModifier.test.js +2 -0
- package/__TEST__/modifier/hasModifier.test.js +2 -0
- package/__TEST__/modifier/overrideModifiers.test.js +2 -0
- package/__TEST__/modifier.test.js +2 -0
- package/__TEST__/order/addItem.test.js +2 -0
- package/__TEST__/order/addItemsToSubOrder.js +9 -3
- package/__TEST__/order/applyRefund.test.js +2 -0
- package/__TEST__/order/conditionsNotMet.test.js +2 -0
- package/__TEST__/order/createSubOrder.test.js +10 -2
- package/__TEST__/order/getGiftModifierSources.test.js +8 -2
- package/__TEST__/order/getPaidGiftModifiers.test.js +3 -3
- package/__TEST__/order/getParentTotals.test.js +2 -0
- package/__TEST__/order/getSameItems.test.js +2 -0
- package/__TEST__/order/hasSerial.test.js +2 -0
- package/__TEST__/order/manualSplit.test.js +2 -0
- package/__TEST__/order/normalizeEndDate.test.js +11 -13
- package/__TEST__/order/order-payment-modifier.test.js +2 -0
- package/__TEST__/order/order.test.js +8 -6
- package/__TEST__/order/pickEndDate.test.js +48 -54
- package/__TEST__/order/setPieces.test.js +2 -0
- package/__TEST__/order/split.test.js +14 -16
- package/__TEST__/order/unpick.order.test.js +2 -0
- package/__TEST__/payment/getPaymentItemIds.test.js +33 -9
- package/__TEST__/payment/getPaymentOrderIds.test.js +24 -8
- package/__TEST__/payment.test.js +79 -53
- package/lib/index.js +7 -2
- package/lib/order/getCustomerStoreCredit.js +1 -0
- package/lib/payment/getMaxAmountsToRefund.js +31 -0
- package/lib/payment/getMethodLabel.js +1 -1
- package/lib/payment/index.js +2 -4
- package/package.json +2 -2
- package/lib/payment/getMaxAmountToRefund.js +0 -14
- package/lib/payment/getMaxAmountToVoid.js +0 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = ({ settings, _ }) =>
|
|
2
2
|
function getMethodLabel({ paymentProvider }) {
|
|
3
|
-
const methods = _.get(settings, '
|
|
3
|
+
const methods = _.get(settings, 'payment.methods', {});
|
|
4
4
|
|
|
5
5
|
if (!paymentProvider || !methods[paymentProvider]) return '';
|
|
6
6
|
return methods[paymentProvider].label || '';
|
package/lib/payment/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
const
|
|
3
|
-
const getMaxAmountToVoid = require('./getMaxAmountToVoid');
|
|
2
|
+
const getMaxAmountsToRefund = require('./getMaxAmountsToRefund');
|
|
4
3
|
const getRefundableOrderAmount = require('./getRefundableOrderAmount');
|
|
5
4
|
const getMethodLabel = require('./getMethodLabel');
|
|
6
5
|
const getOverPaidOrders = require('./getOverPaidOrders');
|
|
@@ -16,8 +15,7 @@ const orderActions = (deps = {}) => {
|
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
const freezedActions = Object.freeze({
|
|
19
|
-
|
|
20
|
-
getMaxAmountToVoid: getMaxAmountToVoid(innerDeps),
|
|
18
|
+
getMaxAmountsToRefund: getMaxAmountsToRefund(innerDeps),
|
|
21
19
|
getRefundableOrderAmount: getRefundableOrderAmount(innerDeps),
|
|
22
20
|
getMethodLabel: getMethodLabel(innerDeps),
|
|
23
21
|
getOverPaidOrders: getOverPaidOrders(innerDeps),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkpos/pricing",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.173",
|
|
4
4
|
"description": "Pricing calculator",
|
|
5
5
|
"author": "Dark POS",
|
|
6
6
|
"license": "ISC",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"supertest": "^6.2.3",
|
|
55
55
|
"supervisor": "^0.12.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "1e2f77636a8b7470dbb07c4ec0c85c625c4827b5"
|
|
58
58
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module.exports = ({ utils }) => {
|
|
2
|
-
const { math } = utils;
|
|
3
|
-
|
|
4
|
-
return function getMaxAmountToRefund({ payment }) {
|
|
5
|
-
if (!payment) return 0;
|
|
6
|
-
return math.sub(
|
|
7
|
-
payment.amount,
|
|
8
|
-
payment.credit || 0,
|
|
9
|
-
payment.change || 0,
|
|
10
|
-
payment.tip || 0,
|
|
11
|
-
payment.refund || 0
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module.exports = ({ utils }) => {
|
|
2
|
-
const { math } = utils;
|
|
3
|
-
|
|
4
|
-
return function getMaxAmountToVoid({ payment }) {
|
|
5
|
-
if (!payment) return 0;
|
|
6
|
-
|
|
7
|
-
return math.sub(
|
|
8
|
-
payment.amount,
|
|
9
|
-
payment.credit || 0,
|
|
10
|
-
payment.change || 0,
|
|
11
|
-
payment.refund || 0
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
};
|