@darkpos/pricing 1.0.39 → 1.0.40
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/lib/constants/index.js +1 -1
- package/lib/item/getItemModifiers.js +0 -1
- package/lib/item/getItemsTotalQuantity.js +1 -1
- package/lib/item/getTotalPrice.js +0 -1
- package/lib/item/index.js +0 -4
- package/lib/modifier/calculate.js +3 -3
- package/lib/modifier/createCreditModifier.js +2 -4
- package/lib/modifier/getItemModifiers.js +2 -3
- package/lib/order/pickEndDate.js +2 -0
- package/package.json +2 -2
- package/lib/item/filterByDirectModifiers.js +0 -13
- package/lib/item/openRecommendationDialog.js +0 -4
package/lib/constants/index.js
CHANGED
package/lib/item/index.js
CHANGED
|
@@ -11,10 +11,8 @@ const create = require('./create');
|
|
|
11
11
|
const hasModifier = require('./hasModifier');
|
|
12
12
|
const isSelected = require('./isSelected');
|
|
13
13
|
const hasModifiers = require('./hasModifiers');
|
|
14
|
-
const openRecommendationDialog = require('./openRecommendationDialog');
|
|
15
14
|
const addIndirectModifier = require('./addIndirectModifier');
|
|
16
15
|
const calculate = require('./calculate');
|
|
17
|
-
const filterByDirectModifiers = require('./filterByDirectModifiers');
|
|
18
16
|
const getItemPrice = require('./getItemPrice');
|
|
19
17
|
const getDepartmentModifiers = require('./getDepartmentModifiers');
|
|
20
18
|
const hasSubscription = require('./hasSubscription');
|
|
@@ -62,10 +60,8 @@ const itemActions = (deps = {}) => {
|
|
|
62
60
|
hasModifier: hasModifier(innerDeps),
|
|
63
61
|
isSelected: isSelected(innerDeps),
|
|
64
62
|
hasModifiers: hasModifiers(innerDeps),
|
|
65
|
-
openRecommendationDialog: openRecommendationDialog(innerDeps),
|
|
66
63
|
addIndirectModifier: addIndirectModifier(innerDeps),
|
|
67
64
|
calculate: calculate(innerDeps),
|
|
68
|
-
filterByDirectModifiers: filterByDirectModifiers(innerDeps),
|
|
69
65
|
getItemPrice: getItemPrice(innerDeps),
|
|
70
66
|
getDepartmentModifiers: getDepartmentModifiers(innerDeps),
|
|
71
67
|
hasSubscription: hasSubscription(innerDeps),
|
|
@@ -23,10 +23,10 @@ module.exports = ({ _, constants, utils, localization, actions }) => {
|
|
|
23
23
|
const maxAmountProp = actions.getProperty(modifier, 'maxAmount');
|
|
24
24
|
|
|
25
25
|
if (!options.skip) {
|
|
26
|
-
const maxAmountCalc =
|
|
26
|
+
const maxAmountCalc =
|
|
27
27
|
actions.isFixedAdd(modifier) || actions.isAmountOverride(modifier)
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
? amount
|
|
29
|
+
: math.mul(options.price, options.quantity);
|
|
30
30
|
|
|
31
31
|
const maxAmount = maxAmountProp
|
|
32
32
|
? math.min(maxAmountProp, maxAmountCalc)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
module.exports = ({ _, actions }) =>
|
|
2
|
-
|
|
3
|
-
return function createCreditModifier(modifier = {}) {
|
|
1
|
+
module.exports = ({ _, actions }) =>
|
|
2
|
+
function createCreditModifier(modifier = {}) {
|
|
4
3
|
const { customerStoredCredit, ...rest } = _.cloneDeep(modifier);
|
|
5
4
|
if (!customerStoredCredit) return null;
|
|
6
5
|
let creditModifier;
|
|
@@ -27,4 +26,3 @@ module.exports = ({ _, actions }) => {
|
|
|
27
26
|
};
|
|
28
27
|
return creditModifier;
|
|
29
28
|
};
|
|
30
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module.exports = ({ actions }) =>
|
|
2
|
-
|
|
1
|
+
module.exports = ({ actions }) =>
|
|
2
|
+
function getItemModifiers({ modifiers, customer, cache }) {
|
|
3
3
|
const matchedModifiers = actions.getMatchTagsModifiers({
|
|
4
4
|
modifiers,
|
|
5
5
|
entity: customer,
|
|
@@ -34,4 +34,3 @@ module.exports = ({ actions }) => {
|
|
|
34
34
|
modifierId: each.modifierId || each._id,
|
|
35
35
|
}));
|
|
36
36
|
};
|
|
37
|
-
};
|
package/lib/order/pickEndDate.js
CHANGED
|
@@ -48,8 +48,10 @@ module.exports = ({ settings, _, moment }) => {
|
|
|
48
48
|
// day condition stays working until addDaysCounter is greater than loop
|
|
49
49
|
if (
|
|
50
50
|
!shouldSkip ||
|
|
51
|
+
// eslint-disable-next-line no-loop-func
|
|
51
52
|
!closedDays.some(closedDay => closedDay.date.isSame(endDateTZ, 'day'))
|
|
52
53
|
) {
|
|
54
|
+
// eslint-disable-next-line no-plusplus
|
|
53
55
|
addDaysCounter++;
|
|
54
56
|
}
|
|
55
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkpos/pricing",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "Pricing calculator",
|
|
5
5
|
"author": "Dark POS",
|
|
6
6
|
"license": "ISC",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"supertest": "^6.2.3",
|
|
37
37
|
"supervisor": "^0.12.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "da5bee1f9a5c7e67c1776be8c31b093551d5df0d"
|
|
40
40
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove order modifiers from items
|
|
3
|
-
*/
|
|
4
|
-
module.exports = ({ modifierActions }) =>
|
|
5
|
-
//
|
|
6
|
-
function filterByDirectModifiers(items = []) {
|
|
7
|
-
return items.map(item => ({
|
|
8
|
-
...item,
|
|
9
|
-
modifiers: (item.modifiers || []).filter(modifier =>
|
|
10
|
-
modifierActions.isDirect(modifier)
|
|
11
|
-
),
|
|
12
|
-
}));
|
|
13
|
-
};
|