@darkpos/pricing 1.0.86 → 1.0.87

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.
@@ -1,24 +1,37 @@
1
- module.exports = ({ actions }) =>
2
- function createSubOrder({ parentOrder, items }) {
1
+ module.exports = ({ actions, settings, _ }) => {
2
+ const orderSettings = _.get(settings, 'order');
3
+
4
+ return function createSubOrder({ parentOrder, items }) {
5
+ // exclude props from order
6
+ const {
7
+ _id,
8
+ displayId,
9
+ parentId,
10
+ isParent,
11
+ subTotal,
12
+ discount,
13
+ fee,
14
+ tax,
15
+ total,
16
+ items: parentItems,
17
+ modifiers,
18
+ status,
19
+ ...rest
20
+ } = parentOrder;
21
+
3
22
  const subOrder = actions.create({
4
- // ...order,
5
- displayId: null,
6
- discount: 0,
7
- tax: 0,
8
- totalPaid: 0,
9
- total: 0,
23
+ ...rest,
24
+ parentId: orderSettings.allowSuborder ? _id : null,
10
25
  status: {
11
26
  order: 'open',
12
- delivery: parentOrder.status.delivery,
13
- detailed: parentOrder.status.detailed,
27
+ delivery: status.delivery || false,
28
+ detailed: status.detailed || false,
14
29
  fullyPaid: false,
15
30
  fullyPicked: false,
16
31
  },
17
- parentId: parentOrder._id,
18
32
  items,
19
- modifiers: [],
20
- notes: parentOrder.notes || [],
21
33
  });
22
34
 
23
35
  return subOrder;
24
36
  };
37
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkpos/pricing",
3
- "version": "1.0.86",
3
+ "version": "1.0.87",
4
4
  "description": "Pricing calculator",
5
5
  "author": "Dark POS",
6
6
  "license": "ISC",
@@ -51,5 +51,5 @@
51
51
  "supertest": "^6.2.3",
52
52
  "supervisor": "^0.12.0"
53
53
  },
54
- "gitHead": "feab9f47beb2312e3b82bae4eb2ec63f18d64be3"
54
+ "gitHead": "db2f94064217c3854f11ea7da9e4e2793ee5a387"
55
55
  }