@medusajs/order 0.1.3-snapshot-20240718073308 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +8 -6
- package/dist/index.js +26 -4
- package/dist/index.js.map +1 -1
- package/dist/joiner-config.d.ts +5 -0
- package/dist/joiner-config.js +36 -0
- package/dist/joiner-config.js.map +1 -0
- package/dist/migrations/Migration20240219102530.d.ts +0 -1
- package/dist/migrations/Migration20240219102530.js +4 -38
- package/dist/migrations/Migration20240219102530.js.map +1 -1
- package/dist/models/address.d.ts +1 -2
- package/dist/models/adjustment-line.d.ts +1 -3
- package/dist/models/adjustment-line.js +0 -5
- package/dist/models/adjustment-line.js.map +1 -1
- package/dist/models/index.d.ts +0 -9
- package/dist/models/index.js +1 -17
- package/dist/models/index.js.map +1 -1
- package/dist/models/line-item-adjustment.d.ts +1 -3
- package/dist/models/line-item-adjustment.js +3 -3
- package/dist/models/line-item-adjustment.js.map +1 -1
- package/dist/models/line-item-tax-line.d.ts +1 -3
- package/dist/models/line-item-tax-line.js +3 -3
- package/dist/models/line-item-tax-line.js.map +1 -1
- package/dist/models/line-item.d.ts +1 -3
- package/dist/models/line-item.js +4 -18
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order-change-action.d.ts +4 -15
- package/dist/models/order-change-action.js +7 -102
- package/dist/models/order-change-action.js.map +1 -1
- package/dist/models/order-change.d.ts +5 -17
- package/dist/models/order-change.js +4 -109
- package/dist/models/order-change.js.map +1 -1
- package/dist/models/order-item.d.ts +4 -5
- package/dist/models/order-item.js +13 -13
- package/dist/models/order-item.js.map +1 -1
- package/dist/models/order-shipping-method.d.ts +4 -14
- package/dist/models/order-shipping-method.js +13 -89
- package/dist/models/order-shipping-method.js.map +1 -1
- package/dist/models/order-summary.d.ts +2 -6
- package/dist/models/order-summary.js +6 -9
- package/dist/models/order-summary.js.map +1 -1
- package/dist/models/order.d.ts +4 -6
- package/dist/models/order.js +1 -11
- package/dist/models/order.js.map +1 -1
- package/dist/models/shipping-method-adjustment.d.ts +1 -3
- package/dist/models/shipping-method-adjustment.js +3 -3
- package/dist/models/shipping-method-adjustment.js.map +1 -1
- package/dist/models/shipping-method-tax-line.d.ts +1 -3
- package/dist/models/shipping-method-tax-line.js +3 -3
- package/dist/models/shipping-method-tax-line.js.map +1 -1
- package/dist/models/shipping-method.d.ts +0 -2
- package/dist/models/shipping-method.js +4 -17
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/tax-line.d.ts +0 -2
- package/dist/models/tax-line.js +0 -7
- package/dist/models/tax-line.js.map +1 -1
- package/dist/models/transaction.d.ts +3 -15
- package/dist/models/transaction.js +4 -109
- package/dist/models/transaction.js.map +1 -1
- package/dist/module-definition.d.ts +2 -0
- package/dist/module-definition.js +59 -0
- package/dist/module-definition.js.map +1 -0
- package/dist/repositories/index.d.ts +1 -4
- package/dist/repositories/index.js +16 -7
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/order.d.ts +3 -1
- package/dist/repositories/order.js +85 -2
- package/dist/repositories/order.js.map +1 -1
- package/dist/scripts/bin/run-seed.d.ts +3 -0
- package/dist/scripts/bin/run-seed.js +49 -0
- package/dist/scripts/bin/run-seed.js.map +1 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +3 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/order-change-service.d.ts +15 -0
- package/dist/services/order-change-service.js +96 -0
- package/dist/services/order-change-service.js.map +1 -0
- package/dist/services/order-module-service.d.ts +67 -138
- package/dist/services/order-module-service.js +240 -990
- package/dist/services/order-module-service.js.map +1 -1
- package/dist/services/order-service.d.ts +4 -5
- package/dist/services/order-service.js +1 -1
- package/dist/services/order-service.js.map +1 -1
- package/dist/types/address.d.ts +0 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/line-item-adjustment.d.ts +0 -1
- package/dist/types/line-item-tax-line.d.ts +0 -1
- package/dist/types/line-item.d.ts +0 -1
- package/dist/types/order-detail.d.ts +1 -2
- package/dist/types/order.d.ts +2 -3
- package/dist/types/shipping-method-adjustment.d.ts +0 -1
- package/dist/types/shipping-method-tax-line.d.ts +0 -1
- package/dist/types/shipping-method.d.ts +0 -4
- package/dist/types/tax-line.d.ts +0 -1
- package/dist/types/transaction.d.ts +0 -1
- package/dist/types/utils/index.d.ts +11 -43
- package/dist/types/utils/index.js.map +1 -1
- package/dist/utils/action-key.d.ts +13 -0
- package/dist/utils/action-key.js +18 -0
- package/dist/utils/action-key.js.map +1 -0
- package/dist/utils/actions/cancel-return.d.ts +0 -1
- package/dist/utils/actions/cancel-return.js +6 -7
- package/dist/utils/actions/cancel-return.js.map +1 -1
- package/dist/utils/actions/cancel.d.ts +0 -1
- package/dist/utils/actions/cancel.js +2 -2
- package/dist/utils/actions/cancel.js.map +1 -1
- package/dist/utils/actions/fulfill-item.d.ts +0 -1
- package/dist/utils/actions/fulfill-item.js +6 -7
- package/dist/utils/actions/fulfill-item.js.map +1 -1
- package/dist/utils/actions/index.d.ts +0 -4
- package/dist/utils/actions/index.js +0 -3
- package/dist/utils/actions/index.js.map +1 -1
- package/dist/utils/actions/item-add.d.ts +0 -1
- package/dist/utils/actions/item-add.js +14 -17
- package/dist/utils/actions/item-add.js.map +1 -1
- package/dist/utils/actions/item-remove.d.ts +0 -1
- package/dist/utils/actions/item-remove.js +10 -11
- package/dist/utils/actions/item-remove.js.map +1 -1
- package/dist/utils/actions/receive-damaged-return-item.d.ts +0 -1
- package/dist/utils/actions/receive-damaged-return-item.js +7 -8
- package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
- package/dist/utils/actions/receive-return-item.d.ts +0 -1
- package/dist/utils/actions/receive-return-item.js +7 -8
- package/dist/utils/actions/receive-return-item.js.map +1 -1
- package/dist/utils/actions/return-item.d.ts +0 -1
- package/dist/utils/actions/return-item.js +8 -9
- package/dist/utils/actions/return-item.js.map +1 -1
- package/dist/utils/actions/ship-item.d.ts +0 -1
- package/dist/utils/actions/ship-item.js +6 -7
- package/dist/utils/actions/ship-item.js.map +1 -1
- package/dist/utils/actions/shipping-add.d.ts +0 -1
- package/dist/utils/actions/shipping-add.js +7 -16
- package/dist/utils/actions/shipping-add.js.map +1 -1
- package/dist/utils/actions/write-off-item.d.ts +0 -1
- package/dist/utils/actions/write-off-item.js +6 -7
- package/dist/utils/actions/write-off-item.js.map +1 -1
- package/dist/utils/calculate-order-change.d.ts +2 -11
- package/dist/utils/calculate-order-change.js +70 -68
- package/dist/utils/calculate-order-change.js.map +1 -1
- package/dist/utils/index.d.ts +1 -4
- package/dist/utils/index.js +1 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/transform-order.d.ts +2 -4
- package/dist/utils/transform-order.js +17 -131
- package/dist/utils/transform-order.js.map +1 -1
- package/package.json +14 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/migrations/Migration20240219102530.d.ts.map +0 -1
- package/dist/migrations/Migration20240604100512.d.ts +0 -5
- package/dist/migrations/Migration20240604100512.d.ts.map +0 -1
- package/dist/migrations/Migration20240604100512.js +0 -364
- package/dist/migrations/Migration20240604100512.js.map +0 -1
- package/dist/migrations/Migration20240715102100.d.ts +0 -5
- package/dist/migrations/Migration20240715102100.d.ts.map +0 -1
- package/dist/migrations/Migration20240715102100.js +0 -15
- package/dist/migrations/Migration20240715102100.js.map +0 -1
- package/dist/migrations/Migration20240715174100.d.ts +0 -5
- package/dist/migrations/Migration20240715174100.d.ts.map +0 -1
- package/dist/migrations/Migration20240715174100.js +0 -21
- package/dist/migrations/Migration20240715174100.js.map +0 -1
- package/dist/migrations/Migration20240716081800.d.ts +0 -5
- package/dist/migrations/Migration20240716081800.d.ts.map +0 -1
- package/dist/migrations/Migration20240716081800.js +0 -67
- package/dist/migrations/Migration20240716081800.js.map +0 -1
- package/dist/models/address.d.ts.map +0 -1
- package/dist/models/adjustment-line.d.ts.map +0 -1
- package/dist/models/claim-item-image.d.ts +0 -19
- package/dist/models/claim-item-image.d.ts.map +0 -1
- package/dist/models/claim-item-image.js +0 -109
- package/dist/models/claim-item-image.js.map +0 -1
- package/dist/models/claim-item.d.ts +0 -29
- package/dist/models/claim-item.d.ts.map +0 -1
- package/dist/models/claim-item.js +0 -156
- package/dist/models/claim-item.js.map +0 -1
- package/dist/models/claim.d.ts +0 -36
- package/dist/models/claim.d.ts.map +0 -1
- package/dist/models/claim.js +0 -195
- package/dist/models/claim.js.map +0 -1
- package/dist/models/exchange-item.d.ts +0 -24
- package/dist/models/exchange-item.d.ts.map +0 -1
- package/dist/models/exchange-item.js +0 -138
- package/dist/models/exchange-item.js.map +0 -1
- package/dist/models/exchange.d.ts +0 -34
- package/dist/models/exchange.d.ts.map +0 -1
- package/dist/models/exchange.js +0 -188
- package/dist/models/exchange.js.map +0 -1
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/line-item-adjustment.d.ts.map +0 -1
- package/dist/models/line-item-tax-line.d.ts.map +0 -1
- package/dist/models/line-item.d.ts.map +0 -1
- package/dist/models/order-change-action.d.ts.map +0 -1
- package/dist/models/order-change.d.ts.map +0 -1
- package/dist/models/order-item.d.ts.map +0 -1
- package/dist/models/order-shipping-method.d.ts.map +0 -1
- package/dist/models/order-summary.d.ts.map +0 -1
- package/dist/models/order.d.ts.map +0 -1
- package/dist/models/return-item.d.ts +0 -29
- package/dist/models/return-item.d.ts.map +0 -1
- package/dist/models/return-item.js +0 -170
- package/dist/models/return-item.js.map +0 -1
- package/dist/models/return-reason.d.ts +0 -21
- package/dist/models/return-reason.d.ts.map +0 -1
- package/dist/models/return-reason.js +0 -120
- package/dist/models/return-reason.js.map +0 -1
- package/dist/models/return.d.ts +0 -39
- package/dist/models/return.d.ts.map +0 -1
- package/dist/models/return.js +0 -216
- package/dist/models/return.js.map +0 -1
- package/dist/models/shipping-method-adjustment.d.ts.map +0 -1
- package/dist/models/shipping-method-tax-line.d.ts.map +0 -1
- package/dist/models/shipping-method.d.ts.map +0 -1
- package/dist/models/tax-line.d.ts.map +0 -1
- package/dist/models/transaction.d.ts.map +0 -1
- package/dist/repositories/claim.d.ts +0 -9
- package/dist/repositories/claim.d.ts.map +0 -1
- package/dist/repositories/claim.js +0 -11
- package/dist/repositories/claim.js.map +0 -1
- package/dist/repositories/exchange.d.ts +0 -9
- package/dist/repositories/exchange.d.ts.map +0 -1
- package/dist/repositories/exchange.js +0 -11
- package/dist/repositories/exchange.js.map +0 -1
- package/dist/repositories/index.d.ts.map +0 -1
- package/dist/repositories/order.d.ts.map +0 -1
- package/dist/repositories/return.d.ts +0 -9
- package/dist/repositories/return.d.ts.map +0 -1
- package/dist/repositories/return.js +0 -11
- package/dist/repositories/return.js.map +0 -1
- package/dist/services/actions/cancel-claim.d.ts +0 -3
- package/dist/services/actions/cancel-claim.d.ts.map +0 -1
- package/dist/services/actions/cancel-claim.js +0 -107
- package/dist/services/actions/cancel-claim.js.map +0 -1
- package/dist/services/actions/cancel-exchange.d.ts +0 -3
- package/dist/services/actions/cancel-exchange.d.ts.map +0 -1
- package/dist/services/actions/cancel-exchange.js +0 -92
- package/dist/services/actions/cancel-exchange.js.map +0 -1
- package/dist/services/actions/cancel-fulfillment.d.ts +0 -3
- package/dist/services/actions/cancel-fulfillment.d.ts.map +0 -1
- package/dist/services/actions/cancel-fulfillment.js +0 -32
- package/dist/services/actions/cancel-fulfillment.js.map +0 -1
- package/dist/services/actions/cancel-return.d.ts +0 -3
- package/dist/services/actions/cancel-return.d.ts.map +0 -1
- package/dist/services/actions/cancel-return.js +0 -72
- package/dist/services/actions/cancel-return.js.map +0 -1
- package/dist/services/actions/create-claim.d.ts +0 -3
- package/dist/services/actions/create-claim.d.ts.map +0 -1
- package/dist/services/actions/create-claim.js +0 -228
- package/dist/services/actions/create-claim.js.map +0 -1
- package/dist/services/actions/create-exchange.d.ts +0 -3
- package/dist/services/actions/create-exchange.d.ts.map +0 -1
- package/dist/services/actions/create-exchange.js +0 -193
- package/dist/services/actions/create-exchange.js.map +0 -1
- package/dist/services/actions/create-return.d.ts +0 -3
- package/dist/services/actions/create-return.d.ts.map +0 -1
- package/dist/services/actions/create-return.js +0 -102
- package/dist/services/actions/create-return.js.map +0 -1
- package/dist/services/actions/index.d.ts +0 -11
- package/dist/services/actions/index.d.ts.map +0 -1
- package/dist/services/actions/index.js +0 -27
- package/dist/services/actions/index.js.map +0 -1
- package/dist/services/actions/receive-return.d.ts +0 -3
- package/dist/services/actions/receive-return.d.ts.map +0 -1
- package/dist/services/actions/receive-return.js +0 -73
- package/dist/services/actions/receive-return.js.map +0 -1
- package/dist/services/actions/register-fulfillment.d.ts +0 -3
- package/dist/services/actions/register-fulfillment.d.ts.map +0 -1
- package/dist/services/actions/register-fulfillment.js +0 -30
- package/dist/services/actions/register-fulfillment.js.map +0 -1
- package/dist/services/actions/register-shipment.d.ts +0 -3
- package/dist/services/actions/register-shipment.d.ts.map +0 -1
- package/dist/services/actions/register-shipment.js +0 -38
- package/dist/services/actions/register-shipment.js.map +0 -1
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/order-module-service.d.ts.map +0 -1
- package/dist/services/order-service.d.ts.map +0 -1
- package/dist/types/address.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/line-item-adjustment.d.ts.map +0 -1
- package/dist/types/line-item-tax-line.d.ts.map +0 -1
- package/dist/types/line-item.d.ts.map +0 -1
- package/dist/types/order-change.d.ts +0 -6
- package/dist/types/order-change.d.ts.map +0 -1
- package/dist/types/order-change.js +0 -3
- package/dist/types/order-change.js.map +0 -1
- package/dist/types/order-detail.d.ts.map +0 -1
- package/dist/types/order.d.ts.map +0 -1
- package/dist/types/shipping-method-adjustment.d.ts.map +0 -1
- package/dist/types/shipping-method-tax-line.d.ts.map +0 -1
- package/dist/types/shipping-method.d.ts.map +0 -1
- package/dist/types/tax-line.d.ts.map +0 -1
- package/dist/types/transaction.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/utils/actions/cancel-item-fulfillment.d.ts +0 -2
- package/dist/utils/actions/cancel-item-fulfillment.d.ts.map +0 -1
- package/dist/utils/actions/cancel-item-fulfillment.js +0 -39
- package/dist/utils/actions/cancel-item-fulfillment.js.map +0 -1
- package/dist/utils/actions/cancel-return.d.ts.map +0 -1
- package/dist/utils/actions/cancel.d.ts.map +0 -1
- package/dist/utils/actions/fulfill-item.d.ts.map +0 -1
- package/dist/utils/actions/index.d.ts.map +0 -1
- package/dist/utils/actions/item-add.d.ts.map +0 -1
- package/dist/utils/actions/item-remove.d.ts.map +0 -1
- package/dist/utils/actions/receive-damaged-return-item.d.ts.map +0 -1
- package/dist/utils/actions/receive-return-item.d.ts.map +0 -1
- package/dist/utils/actions/reinstate-item.d.ts +0 -2
- package/dist/utils/actions/reinstate-item.d.ts.map +0 -1
- package/dist/utils/actions/reinstate-item.js +0 -37
- package/dist/utils/actions/reinstate-item.js.map +0 -1
- package/dist/utils/actions/return-item.d.ts.map +0 -1
- package/dist/utils/actions/ship-item.d.ts.map +0 -1
- package/dist/utils/actions/shipping-add.d.ts.map +0 -1
- package/dist/utils/actions/shipping-remove.d.ts +0 -2
- package/dist/utils/actions/shipping-remove.d.ts.map +0 -1
- package/dist/utils/actions/shipping-remove.js +0 -41
- package/dist/utils/actions/shipping-remove.js.map +0 -1
- package/dist/utils/actions/write-off-item.d.ts.map +0 -1
- package/dist/utils/apply-order-changes.d.ts +0 -18
- package/dist/utils/apply-order-changes.d.ts.map +0 -1
- package/dist/utils/apply-order-changes.js +0 -95
- package/dist/utils/apply-order-changes.js.map +0 -1
- package/dist/utils/base-repository-find.d.ts +0 -3
- package/dist/utils/base-repository-find.d.ts.map +0 -1
- package/dist/utils/base-repository-find.js +0 -142
- package/dist/utils/base-repository-find.js.map +0 -1
- package/dist/utils/calculate-order-change.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/set-action-reference.d.ts +0 -3
- package/dist/utils/set-action-reference.d.ts.map +0 -1
- package/dist/utils/set-action-reference.js +0 -17
- package/dist/utils/set-action-reference.js.map +0 -1
- package/dist/utils/transform-order.d.ts.map +0 -1
@@ -1,19 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
|
+
const action_key_1 = require("../action-key");
|
4
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.WRITE_OFF_ITEM, {
|
7
|
+
operation({ action, currentOrder }) {
|
8
|
+
var _a;
|
8
9
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
9
|
-
existing.detail.written_off_quantity
|
10
|
+
(_a = existing.detail).written_off_quantity ?? (_a.written_off_quantity = 0);
|
10
11
|
existing.detail.written_off_quantity = utils_1.MathBN.add(existing.detail.written_off_quantity, action.details.quantity);
|
11
|
-
(0, set_action_reference_1.setActionReference)(existing, action, options);
|
12
12
|
},
|
13
13
|
revert({ action, currentOrder }) {
|
14
14
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
15
15
|
existing.detail.written_off_quantity = utils_1.MathBN.sub(existing.detail.written_off_quantity, action.details.quantity);
|
16
|
-
(0, set_action_reference_1.unsetActionReference)(existing, action);
|
17
16
|
},
|
18
17
|
validate({ action, currentOrder }) {
|
19
18
|
const refId = action.details?.reference_id;
|
@@ -22,7 +21,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(utils_1.Change
|
|
22
21
|
}
|
23
22
|
const existing = currentOrder.items.find((item) => item.id === refId);
|
24
23
|
if (!existing) {
|
25
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `
|
24
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Reference ID "${refId}" not found.`);
|
26
25
|
}
|
27
26
|
if (!action.details?.quantity) {
|
28
27
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to write-off item ${refId} is required.`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"write-off-item.js","sourceRoot":"","sources":["../../../src/utils/actions/write-off-item.ts"],"names":[],"mappings":";;AAAA,
|
1
|
+
{"version":3,"file":"write-off-item.js","sourceRoot":"","sources":["../../../src/utils/actions/write-off-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,cAAc,EAAE;IACxE,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;;QAChC,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CACtC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,CACjD,CAAA;QAEF,MAAA,QAAQ,CAAC,MAAM,EAAC,oBAAoB,QAApB,oBAAoB,GAAK,CAAC,EAAA;QAC1C,QAAQ,CAAC,MAAM,CAAC,oBAAoB,GAAG,cAAM,CAAC,GAAG,CAC/C,QAAQ,CAAC,MAAM,CAAC,oBAAoB,EACpC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxB,CAAA;IACH,CAAC;IACD,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;QAC7B,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CACtC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,CACjD,CAAA;QAEF,QAAQ,CAAC,MAAM,CAAC,oBAAoB,GAAG,cAAM,CAAC,GAAG,CAC/C,QAAQ,CAAC,MAAM,CAAC,oBAAoB,EACpC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxB,CAAA;IACH,CAAC;IACD,QAAQ,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,EAAE,YAAY,CAAA;QAC1C,IAAI,CAAC,IAAA,iBAAS,EAAC,KAAK,CAAC,EAAE;YACrB,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,mCAAmC,CACpC,CAAA;SACF;QAED,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,CAAC,CAAA;QAErE,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,iBAAiB,KAAK,cAAc,CACrC,CAAA;SACF;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE;YAC7B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,8BAA8B,KAAK,eAAe,CACnD,CAAA;SACF;QAED,MAAM,iBAAiB,GAAG,QAAS,CAAC,QAAQ,IAAI,CAAC,CAAA;QACjD,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QACtE,IAAI,OAAO,EAAE;YACX,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,gDAAgD,CACjD,CAAA;SACF;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -1,25 +1,19 @@
|
|
1
1
|
import { OrderSummaryDTO } from "@medusajs/types";
|
2
2
|
import { ActionTypeDefinition, InternalOrderChangeEvent, OrderChangeEvent, OrderTransaction, VirtualOrder } from "../types";
|
3
|
-
interface ProcessOptions {
|
4
|
-
addActionReferenceToObject?: boolean;
|
5
|
-
[key: string]: any;
|
6
|
-
}
|
7
3
|
export declare class OrderChangeProcessing {
|
8
4
|
private static typeDefinition;
|
9
5
|
private static defaultConfig;
|
10
6
|
private order;
|
11
7
|
private transactions;
|
12
8
|
private actions;
|
13
|
-
private options;
|
14
9
|
private actionsProcessed;
|
15
10
|
private groupTotal;
|
16
11
|
private summary;
|
17
12
|
static registerActionType(key: string, type: ActionTypeDefinition): void;
|
18
|
-
constructor({ order, transactions, actions,
|
13
|
+
constructor({ order, transactions, actions, }: {
|
19
14
|
order: VirtualOrder;
|
20
15
|
transactions: OrderTransaction[];
|
21
16
|
actions: InternalOrderChangeEvent[];
|
22
|
-
options: ProcessOptions;
|
23
17
|
});
|
24
18
|
private isEventActive;
|
25
19
|
private isEventDone;
|
@@ -31,14 +25,11 @@ export declare class OrderChangeProcessing {
|
|
31
25
|
getSummary(): OrderSummaryDTO;
|
32
26
|
getCurrentOrder(): VirtualOrder;
|
33
27
|
}
|
34
|
-
export declare function calculateOrderChange({ order, transactions, actions,
|
28
|
+
export declare function calculateOrderChange({ order, transactions, actions, }: {
|
35
29
|
order: VirtualOrder;
|
36
30
|
transactions?: OrderTransaction[];
|
37
31
|
actions?: OrderChangeEvent[];
|
38
|
-
options?: ProcessOptions;
|
39
32
|
}): {
|
40
33
|
summary: OrderSummaryDTO;
|
41
34
|
order: VirtualOrder;
|
42
35
|
};
|
43
|
-
export {};
|
44
|
-
//# sourceMappingURL=calculate-order-change.d.ts.map
|
@@ -7,39 +7,24 @@ class OrderChangeProcessing {
|
|
7
7
|
static registerActionType(key, type) {
|
8
8
|
OrderChangeProcessing.typeDefinition[key] = type;
|
9
9
|
}
|
10
|
-
constructor({ order, transactions, actions,
|
11
|
-
this.options = {};
|
10
|
+
constructor({ order, transactions, actions, }) {
|
12
11
|
this.actionsProcessed = {};
|
13
12
|
this.groupTotal = {};
|
14
13
|
this.order = JSON.parse(JSON.stringify(order));
|
15
14
|
this.transactions = JSON.parse(JSON.stringify(transactions ?? []));
|
16
15
|
this.actions = JSON.parse(JSON.stringify(actions ?? []));
|
17
|
-
|
18
|
-
let paid = utils_1.MathBN.convert(0);
|
19
|
-
let refunded = utils_1.MathBN.convert(0);
|
20
|
-
let transactionTotal = utils_1.MathBN.convert(0);
|
21
|
-
for (const tr of transactions) {
|
22
|
-
if (utils_1.MathBN.lt(tr.amount, 0)) {
|
23
|
-
refunded = utils_1.MathBN.add(refunded, utils_1.MathBN.abs(tr.amount));
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
paid = utils_1.MathBN.add(paid, tr.amount);
|
27
|
-
}
|
28
|
-
transactionTotal = utils_1.MathBN.add(transactionTotal, tr.amount);
|
29
|
-
}
|
16
|
+
const transactionTotal = utils_1.MathBN.add(...transactions.map((tr) => tr.amount));
|
30
17
|
(0, utils_1.transformPropertiesToBigNumber)(this.order.metadata);
|
31
18
|
this.summary = {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
paid_total: paid,
|
42
|
-
refunded_total: refunded,
|
19
|
+
futureDifference: 0,
|
20
|
+
futureTemporaryDifference: 0,
|
21
|
+
temporaryDifference: 0,
|
22
|
+
pendingDifference: 0,
|
23
|
+
futureTemporarySum: 0,
|
24
|
+
differenceSum: 0,
|
25
|
+
currentOrderTotal: this.order.total ?? 0,
|
26
|
+
originalOrderTotal: this.order.total ?? 0,
|
27
|
+
transactionTotal,
|
43
28
|
};
|
44
29
|
}
|
45
30
|
isEventActive(action) {
|
@@ -57,6 +42,7 @@ class OrderChangeProcessing {
|
|
57
42
|
return status === undefined || status === _types_1.EVENT_STATUS.PENDING;
|
58
43
|
}
|
59
44
|
processActions() {
|
45
|
+
var _a, _b;
|
60
46
|
for (const action of this.actions) {
|
61
47
|
this.processAction_(action);
|
62
48
|
}
|
@@ -70,45 +56,42 @@ class OrderChangeProcessing {
|
|
70
56
|
...OrderChangeProcessing.typeDefinition[action.action],
|
71
57
|
};
|
72
58
|
const amount = utils_1.MathBN.mult(action.amount, type.isDeduction ? -1 : 1);
|
73
|
-
if (action.
|
74
|
-
this.groupTotal[action.
|
75
|
-
this.groupTotal[action.
|
59
|
+
if (action.group_id && !action.evaluationOnly) {
|
60
|
+
(_a = this.groupTotal)[_b = action.group_id] ?? (_a[_b] = 0);
|
61
|
+
this.groupTotal[action.group_id] = utils_1.MathBN.add(this.groupTotal[action.group_id], amount);
|
76
62
|
}
|
77
63
|
if (type.awaitRequired && !this.isEventDone(action)) {
|
78
64
|
if (action.evaluationOnly) {
|
79
|
-
summary.
|
65
|
+
summary.futureTemporarySum = utils_1.MathBN.add(summary.futureTemporarySum, amount);
|
80
66
|
}
|
81
67
|
else {
|
82
|
-
summary.
|
68
|
+
summary.temporaryDifference = utils_1.MathBN.add(summary.temporaryDifference, amount);
|
83
69
|
}
|
84
70
|
}
|
85
71
|
if (action.evaluationOnly) {
|
86
|
-
summary.
|
72
|
+
summary.futureDifference = utils_1.MathBN.add(summary.futureDifference, amount);
|
87
73
|
}
|
88
74
|
else {
|
89
|
-
if (!this.isEventDone(action) && !action.
|
90
|
-
summary.
|
75
|
+
if (!this.isEventDone(action) && !action.group_id) {
|
76
|
+
summary.differenceSum = utils_1.MathBN.add(summary.differenceSum, amount);
|
91
77
|
}
|
92
|
-
summary.
|
78
|
+
summary.currentOrderTotal = utils_1.MathBN.add(summary.currentOrderTotal, amount);
|
93
79
|
}
|
94
80
|
}
|
95
81
|
const groupSum = utils_1.MathBN.add(...Object.values(this.groupTotal));
|
96
|
-
summary.
|
97
|
-
summary.
|
98
|
-
summary.
|
99
|
-
summary.
|
100
|
-
summary.
|
82
|
+
summary.differenceSum = utils_1.MathBN.add(summary.differenceSum, groupSum);
|
83
|
+
summary.transactionTotal = utils_1.MathBN.sum(...this.transactions.map((tr) => tr.amount));
|
84
|
+
summary.futureTemporaryDifference = utils_1.MathBN.sub(summary.futureDifference, summary.futureTemporarySum);
|
85
|
+
summary.temporaryDifference = utils_1.MathBN.sub(summary.differenceSum, summary.temporaryDifference);
|
86
|
+
summary.pendingDifference = utils_1.MathBN.sub(summary.currentOrderTotal, summary.transactionTotal);
|
101
87
|
}
|
102
88
|
processAction_(action, isReplay = false) {
|
103
|
-
|
104
|
-
if (!(0, utils_1.isPresent)(definedType)) {
|
105
|
-
throw new Error(`Action type ${action.action} is not defined`);
|
106
|
-
}
|
89
|
+
var _a, _b, _c;
|
107
90
|
const type = {
|
108
91
|
...OrderChangeProcessing.defaultConfig,
|
109
|
-
...
|
92
|
+
...OrderChangeProcessing.typeDefinition[action.action],
|
110
93
|
};
|
111
|
-
this.actionsProcessed[action.action]
|
94
|
+
(_a = this.actionsProcessed)[_b = action.action] ?? (_a[_b] = []);
|
112
95
|
if (!isReplay) {
|
113
96
|
this.actionsProcessed[action.action].push(action);
|
114
97
|
}
|
@@ -126,7 +109,6 @@ class OrderChangeProcessing {
|
|
126
109
|
summary: this.summary,
|
127
110
|
transactions: this.transactions,
|
128
111
|
type,
|
129
|
-
options: this.options,
|
130
112
|
};
|
131
113
|
if (typeof type.validate === "function") {
|
132
114
|
type.validate(params);
|
@@ -148,13 +130,13 @@ class OrderChangeProcessing {
|
|
148
130
|
if (action.resolve.reference_id) {
|
149
131
|
this.resolveReferences(action);
|
150
132
|
}
|
151
|
-
const groupId = action.resolve.
|
152
|
-
if (action.resolve.
|
133
|
+
const groupId = action.resolve.group_id ?? "__default";
|
134
|
+
if (action.resolve.group_id) {
|
153
135
|
// resolve all actions in the same group
|
154
136
|
this.resolveGroup(action);
|
155
137
|
}
|
156
138
|
if (action.resolve.amount && !action.evaluationOnly) {
|
157
|
-
this.groupTotal[groupId]
|
139
|
+
(_c = this.groupTotal)[groupId] ?? (_c[groupId] = 0);
|
158
140
|
this.groupTotal[groupId] = utils_1.MathBN.sub(this.groupTotal[groupId], action.resolve.amount);
|
159
141
|
}
|
160
142
|
}
|
@@ -204,7 +186,7 @@ class OrderChangeProcessing {
|
|
204
186
|
const type = OrderChangeProcessing.typeDefinition[actionKey];
|
205
187
|
const actions = this.actionsProcessed[actionKey];
|
206
188
|
for (const action of actions) {
|
207
|
-
if (!resolve?.
|
189
|
+
if (!resolve?.group_id || action?.group_id !== resolve.group_id) {
|
208
190
|
continue;
|
209
191
|
}
|
210
192
|
if (type.revert &&
|
@@ -239,17 +221,42 @@ class OrderChangeProcessing {
|
|
239
221
|
getSummary() {
|
240
222
|
const summary = this.summary;
|
241
223
|
const orderSummary = {
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
paid_total: new utils_1.BigNumber(summary.paid_total),
|
251
|
-
refunded_total: new utils_1.BigNumber(summary.refunded_total),
|
224
|
+
transactionTotal: new utils_1.BigNumber(summary.transactionTotal),
|
225
|
+
originalOrderTotal: new utils_1.BigNumber(summary.originalOrderTotal),
|
226
|
+
currentOrderTotal: new utils_1.BigNumber(summary.currentOrderTotal),
|
227
|
+
temporaryDifference: new utils_1.BigNumber(summary.temporaryDifference),
|
228
|
+
futureDifference: new utils_1.BigNumber(summary.futureDifference),
|
229
|
+
futureTemporaryDifference: new utils_1.BigNumber(summary.futureTemporaryDifference),
|
230
|
+
pendingDifference: new utils_1.BigNumber(summary.pendingDifference),
|
231
|
+
differenceSum: new utils_1.BigNumber(summary.differenceSum),
|
252
232
|
};
|
233
|
+
/*
|
234
|
+
{
|
235
|
+
total: summary.currentOrderTotal
|
236
|
+
|
237
|
+
subtotal: number
|
238
|
+
total_tax: number
|
239
|
+
|
240
|
+
ordered_total: summary.originalOrderTotal
|
241
|
+
fulfilled_total: number
|
242
|
+
returned_total: number
|
243
|
+
return_request_total: number
|
244
|
+
write_off_total: number
|
245
|
+
projected_total: number
|
246
|
+
|
247
|
+
net_total: number
|
248
|
+
net_subtotal: number
|
249
|
+
net_total_tax: number
|
250
|
+
|
251
|
+
future_total: number
|
252
|
+
future_subtotal: number
|
253
|
+
future_total_tax: number
|
254
|
+
future_projected_total: number
|
255
|
+
|
256
|
+
balance: summary.pendingDifference
|
257
|
+
future_balance: number
|
258
|
+
}
|
259
|
+
*/
|
253
260
|
return orderSummary;
|
254
261
|
}
|
255
262
|
getCurrentOrder() {
|
@@ -262,13 +269,8 @@ OrderChangeProcessing.defaultConfig = {
|
|
262
269
|
awaitRequired: false,
|
263
270
|
isDeduction: false,
|
264
271
|
};
|
265
|
-
function calculateOrderChange({ order, transactions = [], actions = [],
|
266
|
-
const calc = new OrderChangeProcessing({
|
267
|
-
order,
|
268
|
-
transactions,
|
269
|
-
actions,
|
270
|
-
options,
|
271
|
-
});
|
272
|
+
function calculateOrderChange({ order, transactions = [], actions = [], }) {
|
273
|
+
const calc = new OrderChangeProcessing({ order, transactions, actions });
|
272
274
|
calc.processActions();
|
273
275
|
return {
|
274
276
|
summary: calc.getSummary(),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"calculate-order-change.js","sourceRoot":"","sources":["../../src/utils/calculate-order-change.ts"],"names":[],"mappings":";;;AACA,2CAMwB;AACxB,mCAQe;AAUf,MAAa,qBAAqB;IAgBzB,MAAM,CAAC,kBAAkB,CAAC,GAAW,EAAE,IAA0B;QACtE,qBAAqB,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAClD,CAAC;IAED,YAAY,EACV,KAAK,EACL,YAAY,EACZ,OAAO,EACP,OAAO,GAMR;QApBO,YAAO,GAAmB,EAAE,CAAA;QAE5B,qBAAgB,GAAkD,EAAE,CAAA;QACpE,eAAU,GAAmC,EAAE,CAAA;QAkBrD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,CAAA;QAClE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;QACxD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,IAAI,IAAI,G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AK,EACL,YAAY,GAAG,EAAE,EACjB,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,EAAE,GAMb;IACC,MAAM,IAAI,GAAG,IAAI,qBAAqB,CAAC;QACrC,KAAK;QACL,YAAY;QACZ,OAAO;QACP,OAAO;KACR,CAAC,CAAA;IACF,IAAI,CAAC,cAAc,EAAE,CAAA;IAErB,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;QAC1B,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE;KAC9B,CAAA;AACH,CAAC;AAvBD,oDAuBC"}
|
1
|
+
{"version":3,"file":"calculate-order-change.js","sourceRoot":"","sources":["../../src/utils/calculate-order-change.ts"],"names":[],"mappings":";;;AACA,2CAKwB;AACxB,mCAQe;AAMf,MAAa,qBAAqB;IAezB,MAAM,CAAC,kBAAkB,CAAC,GAAW,EAAE,IAA0B;QACtE,qBAAqB,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAClD,CAAC;IAED,YAAY,EACV,KAAK,EACL,YAAY,EACZ,OAAO,GAKR;QAhBO,qBAAgB,GAAkD,EAAE,CAAA;QACpE,eAAU,GAAmC,EAAE,CAAA;QAgBrD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,CAAA;QAClE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;QAExD,MAAM,gBAAgB,GAAG,cAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;QAE3E,IAAA,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;IACxE,IAAI,CAAC,cAAc,EAAE,CAAA;IAErB,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;QAC1B,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE;KAC9B,CAAA;AACH,CAAC;AAhBD,oDAgBC"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
@@ -14,9 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./action-key"), exports);
|
17
18
|
__exportStar(require("./actions"), exports);
|
18
|
-
__exportStar(require("./apply-order-changes"), exports);
|
19
19
|
__exportStar(require("./calculate-order-change"), exports);
|
20
|
-
__exportStar(require("./set-action-reference"), exports);
|
21
|
-
__exportStar(require("./transform-order"), exports);
|
22
20
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,4CAAyB;AACzB,2DAAwC"}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import { OrderTypes } from "@medusajs/types";
|
2
2
|
export declare function formatOrder(order: any, options: {
|
3
|
-
entity: any;
|
4
3
|
includeTotals?: boolean;
|
5
|
-
}):
|
6
|
-
export declare function mapRepositoryToOrderModel(config: any
|
7
|
-
//# sourceMappingURL=transform-order.d.ts.map
|
4
|
+
}): OrderTypes.OrderDTO | OrderTypes.OrderDTO[];
|
5
|
+
export declare function mapRepositoryToOrderModel(config: any): any;
|
@@ -2,26 +2,11 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.mapRepositoryToOrderModel = exports.formatOrder = void 0;
|
4
4
|
const utils_1 = require("@medusajs/utils");
|
5
|
-
// Reshape the order object to match the OrderDTO
|
6
|
-
// This function is used to format the order object before returning to the main module methods
|
7
5
|
function formatOrder(order, options) {
|
8
6
|
const isArray = Array.isArray(order);
|
9
7
|
const orders = [...(isArray ? order : [order])];
|
10
8
|
orders.map((order) => {
|
11
|
-
|
12
|
-
const isRelatedEntity = options?.entity?.name !== "Order";
|
13
|
-
// If the entity is a related entity, the original order is located in the order property
|
14
|
-
if (isRelatedEntity) {
|
15
|
-
if (!order.order) {
|
16
|
-
return order;
|
17
|
-
}
|
18
|
-
mainOrder = order.order;
|
19
|
-
}
|
20
|
-
mainOrder.items = mainOrder.items?.map((orderItem) => {
|
21
|
-
const isFormatted = (0, utils_1.isDefined)(orderItem.detail?.fulfilled_quantity);
|
22
|
-
if (isFormatted) {
|
23
|
-
return orderItem;
|
24
|
-
}
|
9
|
+
order.items = order.items?.map((orderItem) => {
|
25
10
|
const detail = { ...orderItem };
|
26
11
|
delete detail.order;
|
27
12
|
delete detail.item;
|
@@ -32,105 +17,26 @@ function formatOrder(order, options) {
|
|
32
17
|
detail,
|
33
18
|
};
|
34
19
|
});
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
if (order.shipping_methods) {
|
51
|
-
order.shipping_methods = order.shipping_methods?.map((shippingMethod) => {
|
52
|
-
if (shippingMethod.detail) {
|
53
|
-
return shippingMethod;
|
54
|
-
}
|
55
|
-
const sm = { ...shippingMethod.shipping_method };
|
56
|
-
delete shippingMethod.shipping_method;
|
57
|
-
cleanNestedRelations(shippingMethod);
|
58
|
-
return {
|
59
|
-
...sm,
|
60
|
-
order_id: shippingMethod.order_id,
|
61
|
-
detail: {
|
62
|
-
...shippingMethod,
|
63
|
-
},
|
64
|
-
};
|
65
|
-
});
|
66
|
-
}
|
67
|
-
if (mainOrder.summary) {
|
68
|
-
mainOrder.summary = mainOrder.summary?.[0]?.totals;
|
69
|
-
}
|
70
|
-
return (0, utils_1.createRawPropertiesFromBigNumber)(options?.includeTotals ? (0, utils_1.decorateCartTotals)(order) : order);
|
20
|
+
order.shipping_methods = order.shipping_methods?.map((shippingMethod) => {
|
21
|
+
const sm = { ...shippingMethod.shipping_method };
|
22
|
+
delete shippingMethod.shipping_method;
|
23
|
+
return {
|
24
|
+
...sm,
|
25
|
+
order_id: shippingMethod.order_id,
|
26
|
+
detail: {
|
27
|
+
...shippingMethod,
|
28
|
+
},
|
29
|
+
};
|
30
|
+
});
|
31
|
+
order.summary = order.summary?.[0]?.totals;
|
32
|
+
return options?.includeTotals
|
33
|
+
? (0, utils_1.createRawPropertiesFromBigNumber)((0, utils_1.decorateCartTotals)(order))
|
34
|
+
: order;
|
71
35
|
});
|
72
36
|
return isArray ? orders : orders[0];
|
73
37
|
}
|
74
38
|
exports.formatOrder = formatOrder;
|
75
|
-
function
|
76
|
-
delete obj.order;
|
77
|
-
delete obj.return;
|
78
|
-
delete obj.claim;
|
79
|
-
delete obj.exchange;
|
80
|
-
}
|
81
|
-
function formatOrderReturn(orderReturn, mainOrder) {
|
82
|
-
orderReturn.items?.forEach((orderItem) => {
|
83
|
-
const item = mainOrder.items?.find((item) => item.id === orderItem.item_id);
|
84
|
-
orderItem.detail = item?.detail;
|
85
|
-
});
|
86
|
-
}
|
87
|
-
function formatClaim(claim) {
|
88
|
-
if (claim.additional_items) {
|
89
|
-
claim.additional_items = claim.additional_items.filter((item) => item.is_additional_item);
|
90
|
-
claim.additional_items.forEach((orderItem) => {
|
91
|
-
const item = claim.order.items?.find((item) => item.id === orderItem.item_id);
|
92
|
-
cleanNestedRelations(item);
|
93
|
-
orderItem.detail = item?.detail;
|
94
|
-
});
|
95
|
-
}
|
96
|
-
if (!claim.claim_items) {
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
claim.claim_items = claim.claim_items.filter((item) => !item.is_additional_item);
|
100
|
-
claim.claim_items.forEach((orderItem) => {
|
101
|
-
const item = claim.order.items?.find((item) => item.id === orderItem.item_id);
|
102
|
-
cleanNestedRelations(item);
|
103
|
-
orderItem.detail = item?.detail;
|
104
|
-
});
|
105
|
-
}
|
106
|
-
function formatExchange(exchange) {
|
107
|
-
if (!exchange.additional_items) {
|
108
|
-
return;
|
109
|
-
}
|
110
|
-
exchange.additional_items.forEach((orderItem) => {
|
111
|
-
const item = exchange.order.items?.find((item) => item.id === orderItem.item_id);
|
112
|
-
cleanNestedRelations(item);
|
113
|
-
orderItem.detail = item?.detail;
|
114
|
-
});
|
115
|
-
}
|
116
|
-
function formatReturn(returnOrder) {
|
117
|
-
if (!returnOrder.items) {
|
118
|
-
return;
|
119
|
-
}
|
120
|
-
returnOrder.items.forEach((orderItem) => {
|
121
|
-
const item = returnOrder.order.items?.find((item) => item.id === orderItem.item_id);
|
122
|
-
cleanNestedRelations(item);
|
123
|
-
orderItem.detail = item?.detail;
|
124
|
-
});
|
125
|
-
}
|
126
|
-
// Map the public order model to the repository model format
|
127
|
-
// As the public responses have a different shape than the repository responses, this function is used to map the public properties to the internal db entities
|
128
|
-
// e.g "items" is the relation between "line-item" and "order" + "version", The line item itself is in "items.item"
|
129
|
-
// This helper maps to the correct repository to query the DB, and the function "formatOrder" remap the response to the public shape
|
130
|
-
function mapRepositoryToOrderModel(config, isRelatedEntity = false) {
|
131
|
-
if (isRelatedEntity) {
|
132
|
-
return mapRepositoryToRelatedEntity(config);
|
133
|
-
}
|
39
|
+
function mapRepositoryToOrderModel(config) {
|
134
40
|
const conf = { ...config };
|
135
41
|
function replace(obj, type) {
|
136
42
|
if (!(0, utils_1.isDefined)(obj[type])) {
|
@@ -188,24 +94,4 @@ function mapRepositoryToOrderModel(config, isRelatedEntity = false) {
|
|
188
94
|
return conf;
|
189
95
|
}
|
190
96
|
exports.mapRepositoryToOrderModel = mapRepositoryToOrderModel;
|
191
|
-
// This function has the same purpose as "mapRepositoryToOrderModel" but for returns, claims and exchanges
|
192
|
-
function mapRepositoryToRelatedEntity(config) {
|
193
|
-
const conf = { ...config };
|
194
|
-
function replace(obj, type) {
|
195
|
-
if (!(0, utils_1.isDefined)(obj[type])) {
|
196
|
-
return;
|
197
|
-
}
|
198
|
-
return (0, utils_1.deduplicate)(obj[type].sort().map((rel) => {
|
199
|
-
if (rel.includes("shipping_methods") &&
|
200
|
-
!rel.includes("shipping_methods.shipping_method")) {
|
201
|
-
obj.populate.push("shipping_methods.shipping_method");
|
202
|
-
return rel.replace("shipping_methods", "shipping_methods.shipping_method");
|
203
|
-
}
|
204
|
-
return rel;
|
205
|
-
}));
|
206
|
-
}
|
207
|
-
conf.options.fields = replace(config.options, "fields");
|
208
|
-
conf.options.populate = replace(config.options, "populate");
|
209
|
-
return conf;
|
210
|
-
}
|
211
97
|
//# sourceMappingURL=transform-order.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transform-order.js","sourceRoot":"","sources":["../../src/utils/transform-order.ts"],"names":[],"mappings":";;;AACA,2CAKwB;AAExB,
|
1
|
+
{"version":3,"file":"transform-order.js","sourceRoot":"","sources":["../../src/utils/transform-order.ts"],"names":[],"mappings":";;;AACA,2CAKwB;AAExB,SAAgB,WAAW,CACzB,KAAK,EACL,OAEC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACpC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAE/C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACnB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,CAA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