@medusajs/order 0.1.3-snapshot-20240531102054 → 0.1.3-snapshot-20240701122250
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/joiner-config.d.ts +1 -3
- package/dist/joiner-config.js +4 -42
- package/dist/joiner-config.js.map +1 -1
- package/dist/migrations/Migration20240604100512.d.ts +4 -0
- package/dist/migrations/Migration20240604100512.js +364 -0
- package/dist/migrations/Migration20240604100512.js.map +1 -0
- package/dist/models/claim-item-image.d.ts +18 -0
- package/dist/models/claim-item-image.js +108 -0
- package/dist/models/claim-item-image.js.map +1 -0
- package/dist/models/claim-item.d.ts +28 -0
- package/dist/models/claim-item.js +156 -0
- package/dist/models/claim-item.js.map +1 -0
- package/dist/models/claim.d.ts +35 -0
- package/dist/models/claim.js +196 -0
- package/dist/models/claim.js.map +1 -0
- package/dist/models/exchange-item.d.ts +23 -0
- package/dist/models/exchange-item.js +138 -0
- package/dist/models/exchange-item.js.map +1 -0
- package/dist/models/exchange.d.ts +33 -0
- package/dist/models/exchange.js +189 -0
- package/dist/models/exchange.js.map +1 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.js +15 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/line-item-adjustment.d.ts +2 -1
- package/dist/models/line-item-adjustment.js +1 -1
- package/dist/models/line-item-adjustment.js.map +1 -1
- package/dist/models/line-item-tax-line.d.ts +2 -1
- package/dist/models/line-item-tax-line.js +1 -1
- package/dist/models/line-item-tax-line.js.map +1 -1
- package/dist/models/line-item.d.ts +1 -1
- package/dist/models/line-item.js +3 -3
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order-change-action.d.ts +13 -3
- package/dist/models/order-change-action.js +94 -0
- package/dist/models/order-change-action.js.map +1 -1
- package/dist/models/order-change.d.ts +14 -3
- package/dist/models/order-change.js +107 -3
- package/dist/models/order-change.js.map +1 -1
- package/dist/models/order-item.d.ts +3 -3
- package/dist/models/order-item.js +7 -7
- package/dist/models/order-item.js.map +1 -1
- package/dist/models/order-shipping-method.d.ts +12 -3
- package/dist/models/order-shipping-method.js +83 -7
- package/dist/models/order-shipping-method.js.map +1 -1
- package/dist/models/order-summary.d.ts +3 -2
- package/dist/models/order-summary.js +7 -4
- package/dist/models/order-summary.js.map +1 -1
- package/dist/models/order.d.ts +3 -3
- package/dist/models/order.js +1 -1
- package/dist/models/order.js.map +1 -1
- package/dist/models/return-item.d.ts +28 -0
- package/dist/models/return-item.js +170 -0
- package/dist/models/return-item.js.map +1 -0
- package/dist/models/return-reason.d.ts +3 -3
- package/dist/models/return-reason.js.map +1 -1
- package/dist/models/return.d.ts +38 -0
- package/dist/models/return.js +213 -0
- package/dist/models/return.js.map +1 -0
- package/dist/models/shipping-method-adjustment.d.ts +2 -1
- package/dist/models/shipping-method-adjustment.js +1 -1
- package/dist/models/shipping-method-adjustment.js.map +1 -1
- package/dist/models/shipping-method-tax-line.d.ts +2 -1
- package/dist/models/shipping-method-tax-line.js +1 -1
- package/dist/models/shipping-method-tax-line.js.map +1 -1
- package/dist/models/shipping-method.js +1 -1
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/tax-line.js.map +1 -1
- package/dist/models/transaction.d.ts +11 -2
- package/dist/models/transaction.js +80 -1
- package/dist/models/transaction.js.map +1 -1
- package/dist/repositories/claim.d.ts +8 -0
- package/dist/repositories/claim.js +11 -0
- package/dist/repositories/claim.js.map +1 -0
- package/dist/repositories/exchange.d.ts +8 -0
- package/dist/repositories/exchange.js +11 -0
- package/dist/repositories/exchange.js.map +1 -0
- package/dist/repositories/index.d.ts +3 -1
- package/dist/repositories/index.js +7 -16
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/order.d.ts +0 -3
- package/dist/repositories/order.js +2 -83
- package/dist/repositories/order.js.map +1 -1
- package/dist/repositories/return.d.ts +8 -0
- package/dist/repositories/return.js +11 -0
- package/dist/repositories/return.js.map +1 -0
- package/dist/services/actions/cancel-fulfillment.d.ts +2 -0
- package/dist/services/actions/cancel-fulfillment.js +32 -0
- package/dist/services/actions/cancel-fulfillment.js.map +1 -0
- package/dist/services/actions/create-claim.d.ts +2 -0
- package/dist/services/actions/create-claim.js +229 -0
- package/dist/services/actions/create-claim.js.map +1 -0
- package/dist/services/actions/create-exchange.d.ts +2 -0
- package/dist/services/actions/create-exchange.js +194 -0
- package/dist/services/actions/create-exchange.js.map +1 -0
- package/dist/services/actions/create-return.d.ts +2 -0
- package/dist/services/actions/create-return.js +98 -0
- package/dist/services/actions/create-return.js.map +1 -0
- package/dist/services/actions/index.d.ts +7 -0
- package/dist/services/actions/index.js +24 -0
- package/dist/services/actions/index.js.map +1 -0
- package/dist/services/actions/receive-return.d.ts +2 -0
- package/dist/services/actions/receive-return.js +75 -0
- package/dist/services/actions/receive-return.js.map +1 -0
- package/dist/services/actions/register-fulfillment.d.ts +2 -0
- package/dist/services/actions/register-fulfillment.js +30 -0
- package/dist/services/actions/register-fulfillment.js.map +1 -0
- package/dist/services/actions/register-shipment.d.ts +2 -0
- package/dist/services/actions/register-shipment.js +38 -0
- package/dist/services/actions/register-shipment.js.map +1 -0
- package/dist/services/order-change-service.d.ts +6 -6
- package/dist/services/order-change-service.js +4 -3
- package/dist/services/order-change-service.js.map +1 -1
- package/dist/services/order-module-service.d.ts +103 -63
- package/dist/services/order-module-service.js +486 -266
- package/dist/services/order-module-service.js.map +1 -1
- package/dist/services/order-service.d.ts +4 -4
- package/dist/services/order-service.js +1 -1
- package/dist/services/order-service.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/order-change.d.ts +32 -0
- package/dist/types/order-change.js +34 -0
- package/dist/types/order-change.js.map +1 -0
- package/dist/types/utils/index.d.ts +25 -1
- package/dist/types/utils/index.js.map +1 -1
- package/dist/utils/action-key.d.ts +1 -0
- package/dist/utils/action-key.js +1 -0
- package/dist/utils/action-key.js.map +1 -1
- package/dist/utils/actions/cancel-item-fulfillment.d.ts +1 -0
- package/dist/utils/actions/cancel-item-fulfillment.js +39 -0
- package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -0
- package/dist/utils/actions/cancel-return.js +3 -1
- package/dist/utils/actions/cancel-return.js.map +1 -1
- package/dist/utils/actions/fulfill-item.js +3 -1
- package/dist/utils/actions/fulfill-item.js.map +1 -1
- package/dist/utils/actions/index.d.ts +2 -0
- package/dist/utils/actions/index.js +2 -0
- package/dist/utils/actions/index.js.map +1 -1
- package/dist/utils/actions/item-add.js +10 -7
- package/dist/utils/actions/item-add.js.map +1 -1
- package/dist/utils/actions/item-remove.js +7 -5
- package/dist/utils/actions/item-remove.js.map +1 -1
- package/dist/utils/actions/receive-damaged-return-item.js +3 -1
- package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
- package/dist/utils/actions/receive-return-item.js +3 -1
- package/dist/utils/actions/receive-return-item.js.map +1 -1
- package/dist/utils/actions/return-item.js +3 -1
- package/dist/utils/actions/return-item.js.map +1 -1
- package/dist/utils/actions/ship-item.js +3 -1
- package/dist/utils/actions/ship-item.js.map +1 -1
- package/dist/utils/actions/shipping-add.js +6 -2
- package/dist/utils/actions/shipping-add.js.map +1 -1
- package/dist/utils/actions/write-off-item.js +3 -1
- package/dist/utils/actions/write-off-item.js.map +1 -1
- package/dist/utils/apply-order-changes.d.ts +14 -0
- package/dist/utils/apply-order-changes.js +74 -0
- package/dist/utils/apply-order-changes.js.map +1 -0
- package/dist/utils/base-repository-find.d.ts +2 -0
- package/dist/utils/base-repository-find.js +117 -0
- package/dist/utils/base-repository-find.js.map +1 -0
- package/dist/utils/calculate-order-change.js +5 -1
- package/dist/utils/calculate-order-change.js.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/set-action-reference.d.ts +1 -0
- package/dist/utils/set-action-reference.js +11 -0
- package/dist/utils/set-action-reference.js.map +1 -0
- package/dist/utils/transform-order.d.ts +3 -2
- package/dist/utils/transform-order.js +84 -17
- package/dist/utils/transform-order.js.map +1 -1
- package/package.json +7 -11
- package/dist/module-definition.d.ts +0 -2
- package/dist/module-definition.js +0 -9
- package/dist/module-definition.js.map +0 -1
- package/dist/scripts/bin/run-seed.d.ts +0 -3
- package/dist/scripts/bin/run-seed.js +0 -49
- package/dist/scripts/bin/run-seed.js.map +0 -1
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./cancel"), exports);
|
18
|
+
__exportStar(require("./cancel-item-fulfillment"), exports);
|
18
19
|
__exportStar(require("./cancel-return"), exports);
|
19
20
|
__exportStar(require("./fulfill-item"), exports);
|
20
21
|
__exportStar(require("./item-add"), exports);
|
@@ -24,4 +25,5 @@ __exportStar(require("./receive-return-item"), exports);
|
|
24
25
|
__exportStar(require("./return-item"), exports);
|
25
26
|
__exportStar(require("./ship-item"), exports);
|
26
27
|
__exportStar(require("./shipping-add"), exports);
|
28
|
+
__exportStar(require("./write-off-item"), exports);
|
27
29
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,kDAA+B;AAC/B,iDAA8B;AAC9B,6CAA0B;AAC1B,gDAA6B;AAC7B,gEAA6C;AAC7C,wDAAqC;AACrC,gDAA6B;AAC7B,8CAA2B;AAC3B,iDAA8B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,4DAAyC;AACzC,kDAA+B;AAC/B,iDAA8B;AAC9B,6CAA0B;AAC1B,gDAA6B;AAC7B,gEAA6C;AAC7C,wDAAqC;AACrC,gDAA6B;AAC7B,8CAA2B;AAC3B,iDAA8B;AAC9B,mDAAgC"}
|
@@ -3,17 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.ITEM_ADD, {
|
7
8
|
operation({ action, currentOrder }) {
|
8
|
-
const existing = currentOrder.items.find((item) => item.id === action.reference_id);
|
9
|
+
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
9
10
|
if (existing) {
|
10
11
|
existing.detail.quantity ??= 0;
|
11
12
|
existing.quantity = utils_1.MathBN.add(existing.quantity, action.details.quantity);
|
12
13
|
existing.detail.quantity = utils_1.MathBN.add(existing.detail.quantity, action.details.quantity);
|
14
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
13
15
|
}
|
14
16
|
else {
|
15
17
|
currentOrder.items.push({
|
16
|
-
id: action.reference_id,
|
18
|
+
id: action.details.reference_id,
|
19
|
+
order_id: currentOrder.id,
|
20
|
+
return_id: action.details.return_id,
|
21
|
+
claim_id: action.details.claim_id,
|
22
|
+
exchange_id: action.details.exchange_id,
|
17
23
|
unit_price: action.details.unit_price,
|
18
24
|
quantity: action.details.quantity,
|
19
25
|
});
|
@@ -21,7 +27,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
21
27
|
return utils_1.MathBN.mult(action.details.unit_price, action.details.quantity);
|
22
28
|
},
|
23
29
|
revert({ action, currentOrder }) {
|
24
|
-
const existingIndex = currentOrder.items.findIndex((item) => item.id === action.reference_id);
|
30
|
+
const existingIndex = currentOrder.items.findIndex((item) => item.id === action.details.reference_id);
|
25
31
|
if (existingIndex > -1) {
|
26
32
|
const existing = currentOrder.items[existingIndex];
|
27
33
|
existing.quantity = utils_1.MathBN.sub(existing.quantity, action.details.quantity);
|
@@ -32,10 +38,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
32
38
|
}
|
33
39
|
},
|
34
40
|
validate({ action }) {
|
35
|
-
const refId = action.reference_id;
|
36
|
-
if (!(0, utils_1.isDefined)(action.reference_id)) {
|
37
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
|
38
|
-
}
|
41
|
+
const refId = action.details?.reference_id;
|
39
42
|
if (!(0, utils_1.isDefined)(action.amount) && !(0, utils_1.isDefined)(action.details?.unit_price)) {
|
40
43
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Unit price of item ${refId} is required if no action.amount is provided.`);
|
41
44
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"item-add.js","sourceRoot":"","sources":["../../../src/utils/actions/item-add.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAEhE,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"item-add.js","sourceRoot":"","sources":["../../../src/utils/actions/item-add.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAEhE,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,QAAQ,EAAE;IAClE,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,CAClD,CAAA;QAED,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAA;YAE9B,QAAQ,CAAC,QAAQ,GAAG,cAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CA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AAA;YAC1E,QAAQ,CAAC,MAAM,CAAC,QAAQ,GAAG,cAAM,CAAC,GAAG,CACnC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EACxB,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxB,CAAA;YAED,IAAI,cAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;gBACrC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,EAAE,MAAM,EAAE;QACjB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,EAAE,YAAY,CAAA;QAE1C,IAAI,CAAC,IAAA,iBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,iBAAS,EAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC;YACxE,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sBAAsB,KAAK,+CAA+C,CAC3E,CAAA;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,oBAAoB,KAAK,eAAe,CACzC,CAAA;QACH,CAAC;QAED,IAAI,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,oBAAoB,KAAK,0BAA0B,CACpD,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -3,41 +3,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.ITEM_REMOVE, {
|
7
8
|
isDeduction: true,
|
8
9
|
operation({ action, currentOrder }) {
|
9
|
-
const existingIndex = currentOrder.items.findIndex((item) => item.id === action.reference_id);
|
10
|
+
const existingIndex = currentOrder.items.findIndex((item) => item.id === action.details.reference_id);
|
10
11
|
const existing = currentOrder.items[existingIndex];
|
11
12
|
existing.detail.quantity ??= 0;
|
12
13
|
existing.quantity = utils_1.MathBN.sub(existing.quantity, action.details.quantity);
|
13
14
|
existing.detail.quantity = utils_1.MathBN.sub(existing.detail.quantity, action.details.quantity);
|
15
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
14
16
|
if (utils_1.MathBN.lte(existing.quantity, 0)) {
|
15
17
|
currentOrder.items.splice(existingIndex, 1);
|
16
18
|
}
|
17
19
|
return utils_1.MathBN.mult(existing.unit_price, action.details.quantity);
|
18
20
|
},
|
19
21
|
revert({ action, currentOrder }) {
|
20
|
-
const existing = currentOrder.items.find((item) => item.id === action.reference_id);
|
22
|
+
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
21
23
|
if (existing) {
|
22
24
|
existing.quantity = utils_1.MathBN.add(existing.quantity, action.details.quantity);
|
23
25
|
existing.detail.quantity = utils_1.MathBN.add(existing.detail.quantity, action.details.quantity);
|
24
26
|
}
|
25
27
|
else {
|
26
28
|
currentOrder.items.push({
|
27
|
-
id: action.reference_id,
|
29
|
+
id: action.details.reference_id,
|
28
30
|
unit_price: action.details.unit_price,
|
29
31
|
quantity: action.details.quantity,
|
30
32
|
});
|
31
33
|
}
|
32
34
|
},
|
33
35
|
validate({ action, currentOrder }) {
|
34
|
-
const refId = action.reference_id;
|
36
|
+
const refId = action.details?.reference_id;
|
35
37
|
if (!(0, utils_1.isDefined)(refId)) {
|
36
38
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, "Reference ID is required.");
|
37
39
|
}
|
38
40
|
const existing = currentOrder.items.find((item) => item.id === refId);
|
39
41
|
if (!existing) {
|
40
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `
|
42
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
|
41
43
|
}
|
42
44
|
if (!(0, utils_1.isDefined)(action.amount) && !(0, utils_1.isDefined)(action.details?.unit_price)) {
|
43
45
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Unit price of item ${refId} is required if no action.amount is provided.`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"item-remove.js","sourceRoot":"","sources":["../../../src/utils/actions/item-remove.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAEhE,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"item-remove.js","sourceRoot":"","sources":["../../../src/utils/actions/item-remove.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAEhE,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,WAAW,EAAE;IACrE,WAAW,EAAE,IAAI;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE;QAChC,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,SAAS,CAChD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,YAAY,CAClD,CAAA;QAED,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAElD,QAAQ,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAA;QAE9B,QAAQ,CAAC,QAAQ,GAAG,cAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,OAA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,CACpD,CAAA;QACH,CAAC;QAED,MAAM,YAAY,GAAG,cAAM,CAAC,GAAG,CAC7B,QAAQ,CAAC,QAAQ,EACjB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CACpC,CAAA;QAED,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAA;QACjE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sCAAsC,KAAK,GAAG,CAC/C,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -4,6 +4,7 @@ const utils_1 = require("@medusajs/utils");
|
|
4
4
|
const _types_1 = require("../../types");
|
5
5
|
const action_key_1 = require("../action-key");
|
6
6
|
const calculate_order_change_1 = require("../calculate-order-change");
|
7
|
+
const set_action_reference_1 = require("../set-action-reference");
|
7
8
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.RECEIVE_DAMAGED_RETURN_ITEM, {
|
8
9
|
isDeduction: true,
|
9
10
|
commitsAction: "return_item",
|
@@ -14,6 +15,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
14
15
|
existing.detail.return_requested_quantity ??= 0;
|
15
16
|
existing.detail.return_dismissed_quantity = utils_1.MathBN.add(existing.detail.return_dismissed_quantity, toReturn);
|
16
17
|
existing.detail.return_requested_quantity = utils_1.MathBN.sub(existing.detail.return_requested_quantity, toReturn);
|
18
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
17
19
|
if (previousEvents) {
|
18
20
|
for (const previousEvent of previousEvents) {
|
19
21
|
previousEvent.original_ = JSON.parse(JSON.stringify(previousEvent));
|
@@ -49,7 +51,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
49
51
|
}
|
50
52
|
const existing = currentOrder.items.find((item) => item.id === refId);
|
51
53
|
if (!existing) {
|
52
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `
|
54
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
|
53
55
|
}
|
54
56
|
if (!action.details?.quantity) {
|
55
57
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to return of item ${refId} is required.`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"receive-damaged-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive-damaged-return-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,mCAAqC;AACrC,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"receive-damaged-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive-damaged-return-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,mCAAqC;AACrC,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CACtC,6BAAgB,CAAC,2BAA2B,EAC5C;IACE,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,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,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAA;QAEtC,QAAQ,CAAC,MAAM,CAAC,yBAAyB,KAAK,CAAC,CAAA;QAC/C,QAAQ,CAAC,MAAM,CAAC,yBAAyB,KAAK,CAAC,CAAA;QAE/C,QAAQ,CAAC,MAAM,CAAC,yBAAyB,GAAG,cAAM,CAAC,GAAG,CACpD,QAAQ,CAAC,MAAM,CAAC,yBAAyB,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AAc,CAChC,CAAA;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,8BAA8B,KAAK,eAAe,CACnD,CAAA;QACH,CAAC;QAED,MAAM,iBAAiB,GAAG,QAAQ,EAAE,MAAM,CAAC,yBAAyB,IAAI,CAAC,CAAA;QACzE,IAAI,MAAM,CAAC,OAAO,EAAE,QAAQ,GAAG,iBAAiB,EAAE,CAAC;YACjD,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,6EAA6E,KAAK,GAAG,CACtF,CAAA;QACH,CAAC;IACH,CAAC;CACF,CACF,CAAA"}
|
@@ -4,6 +4,7 @@ const utils_1 = require("@medusajs/utils");
|
|
4
4
|
const _types_1 = require("../../types");
|
5
5
|
const action_key_1 = require("../action-key");
|
6
6
|
const calculate_order_change_1 = require("../calculate-order-change");
|
7
|
+
const set_action_reference_1 = require("../set-action-reference");
|
7
8
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.RECEIVE_RETURN_ITEM, {
|
8
9
|
isDeduction: true,
|
9
10
|
commitsAction: "return_item",
|
@@ -14,6 +15,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
14
15
|
existing.detail.return_requested_quantity ??= 0;
|
15
16
|
existing.detail.return_received_quantity = utils_1.MathBN.add(existing.detail.return_received_quantity, toReturn);
|
16
17
|
existing.detail.return_requested_quantity = utils_1.MathBN.sub(existing.detail.return_requested_quantity, toReturn);
|
18
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
17
19
|
if (previousEvents) {
|
18
20
|
for (const previousEvent of previousEvents) {
|
19
21
|
previousEvent.original_ = JSON.parse(JSON.stringify(previousEvent));
|
@@ -50,7 +52,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
50
52
|
}
|
51
53
|
const existing = currentOrder.items.find((item) => item.id === refId);
|
52
54
|
if (!existing) {
|
53
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `
|
55
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
|
54
56
|
}
|
55
57
|
if (!action.details?.quantity) {
|
56
58
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to receive return of item ${refId} is required.`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"receive-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive-return-item.ts"],"names":[],"mappings":";;AAAA,2CAKwB;AACxB,mCAAqC;AACrC,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"receive-return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/receive-return-item.ts"],"names":[],"mappings":";;AAAA,2CAKwB;AACxB,mCAAqC;AACrC,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,mBAAmB,EAAE;IAC7E,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE;QAChD,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,IAAI,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAA;QAEtC,QAAQ,CAAC,MAAM,CAAC,wBAAwB,KAAK,CAAC,CAAA;QAC9C,QAAQ,CAAC,MAAM,CAAC,yBAAyB,KAAK,CAAC,CAAA;QAE/C,QAAQ,CAAC,MAAM,CAAC,wBAAwB,GAAG,cAAM,CAAC,GAAG,C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AI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,YAAY,KAAK,cAAc,CAChC,CAAA;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sCAAsC,KAAK,eAAe,CAC3D,CAAA;QACH,CAAC;QAED,MAAM,iBAAiB,GAAG,QAAQ,EAAE,MAAM,EAAE,yBAAyB,IAAI,CAAC,CAAA;QAE1E,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QACtE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,6EAA6E,KAAK,GAAG,CACtF,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.RETURN_ITEM, {
|
7
8
|
isDeduction: true,
|
8
9
|
awaitRequired: true,
|
@@ -10,6 +11,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
10
11
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
11
12
|
existing.detail.return_requested_quantity ??= 0;
|
12
13
|
existing.detail.return_requested_quantity = utils_1.MathBN.add(existing.detail.return_requested_quantity, action.details.quantity);
|
14
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
13
15
|
return utils_1.MathBN.mult(existing.unit_price, action.details.quantity);
|
14
16
|
},
|
15
17
|
revert({ action, currentOrder }) {
|
@@ -23,7 +25,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
23
25
|
}
|
24
26
|
const existing = currentOrder.items.find((item) => item.id === refId);
|
25
27
|
if (!existing) {
|
26
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `
|
28
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
|
27
29
|
}
|
28
30
|
if (!action.details?.quantity) {
|
29
31
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to return of item ${refId} is required.`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/return-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"return-item.js","sourceRoot":"","sources":["../../../src/utils/actions/return-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,WAAW,EAAE;IACrE,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,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,QAAQ,CAAC,MAAM,CAAC,yBAAyB,KAAK,CAAC,CAAA;QAC/C,QAAQ,CAAC,MAAM,CAAC,yBAAyB,GAAG,cAAM,CAAC,GAAG,CACpD,QAAQ,CAAC,MAAM,CAAC,yB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BAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,8BAA8B,KAAK,eAAe,CACnD,CAAA;QACH,CAAC;QAED,MAAM,iBAAiB,GAAG,cAAM,CAAC,GAAG,CAClC,QAAS,CAAC,MAAM,EAAE,gBAAgB,IAAI,CAAC,EACvC,QAAS,CAAC,MAAM,EAAE,yBAAyB,IAAI,CAAC,CACjD,CAAA;QAED,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QACtE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,sEAAsE,KAAK,GAAG,CAC/E,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.SHIP_ITEM, {
|
7
8
|
operation({ action, currentOrder }) {
|
8
9
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
9
10
|
existing.detail.shipped_quantity ??= 0;
|
10
11
|
existing.detail.shipped_quantity = utils_1.MathBN.add(existing.detail.shipped_quantity, action.details.quantity);
|
12
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
11
13
|
},
|
12
14
|
revert({ action, currentOrder }) {
|
13
15
|
const existing = currentOrder.items.find((item) => item.id === action.reference_id);
|
@@ -20,7 +22,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
20
22
|
}
|
21
23
|
const existing = currentOrder.items.find((item) => item.id === refId);
|
22
24
|
if (!existing) {
|
23
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `
|
25
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
|
24
26
|
}
|
25
27
|
if (!action.details?.quantity) {
|
26
28
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Quantity to ship of item ${refId} is required.`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ship-item.js","sourceRoot":"","sources":["../../../src/utils/actions/ship-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;
|
1
|
+
{"version":3,"file":"ship-item.js","sourceRoot":"","sources":["../../../src/utils/actions/ship-item.ts"],"names":[],"mappings":";;AAAA,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;AACjE,kEAA4D;AAE5D,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,SAAS,EAAE;IACnE,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,QAAQ,CAAC,MAAM,CAAC,gBAAgB,KAAK,CAAC,CAAA;QAEtC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,GAAG,cAAM,CAAC,GAAG,CAC3C,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAChC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxB,CAAA;QAED,IAAA,yCAAkB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACtC,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,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kB,EACnC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAClC,CAAA;QAED,MAAM,OAAO,GAAG,cAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;QAC/D,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,2DAA2D,KAAK,GAAG,CACpE,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -9,7 +9,11 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
9
9
|
? currentOrder.shipping_methods
|
10
10
|
: [currentOrder.shipping_methods];
|
11
11
|
shipping.push({
|
12
|
-
|
12
|
+
shipping_method_id: action.reference_id,
|
13
|
+
order_id: currentOrder.id,
|
14
|
+
return_id: action.return_id,
|
15
|
+
claim_id: action.claim_id,
|
16
|
+
exchange_id: action.exchange_id,
|
13
17
|
price: action.amount,
|
14
18
|
});
|
15
19
|
currentOrder.shipping_methods = shipping;
|
@@ -18,7 +22,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
18
22
|
const shipping = Array.isArray(currentOrder.shipping_methods)
|
19
23
|
? currentOrder.shipping_methods
|
20
24
|
: [currentOrder.shipping_methods];
|
21
|
-
const existingIndex = shipping.findIndex((item) => item.
|
25
|
+
const existingIndex = shipping.findIndex((item) => item.shipping_method_id === action.reference_id);
|
22
26
|
if (existingIndex > -1) {
|
23
27
|
shipping.splice(existingIndex, 1);
|
24
28
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shipping-add.js","sourceRoot":"","sources":["../../../src/utils/actions/shipping-add.ts"],"names":[],"mappings":";;AAAA,2CAAwD;AACxD,8CAAgD;AAChD,sEAAiE;AAEjE,8CAAqB,CAAC,kBAAkB,CAAC,6BAAgB,CAAC,YAAY,EAAE;IACtE,SAAS,CAAC,EAAE,MA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QAAQ,CAAC,SAAS,CACtC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,KAAK,MAAM,CAAC,YAAY,CAC1D,CAAA;QAED,IAAI,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC;YACvB,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;QACnC,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,EAAE,MAAM,EAAE;QACjB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YACzB,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,2BAA2B,CAC5B,CAAA;QACH,CAAC;QAED,IAAI,CAAC,IAAA,iBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,qBAAqB,CACtB,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("@medusajs/utils");
|
4
4
|
const action_key_1 = require("../action-key");
|
5
5
|
const calculate_order_change_1 = require("../calculate-order-change");
|
6
|
+
const set_action_reference_1 = require("../set-action-reference");
|
6
7
|
calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.ChangeActionType.WRITE_OFF_ITEM, {
|
7
8
|
operation({ action, currentOrder }) {
|
8
9
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
9
10
|
existing.detail.written_off_quantity ??= 0;
|
10
11
|
existing.detail.written_off_quantity = utils_1.MathBN.add(existing.detail.written_off_quantity, action.details.quantity);
|
12
|
+
(0, set_action_reference_1.setActionReference)(existing, action);
|
11
13
|
},
|
12
14
|
revert({ action, currentOrder }) {
|
13
15
|
const existing = currentOrder.items.find((item) => item.id === action.details.reference_id);
|
@@ -20,7 +22,7 @@ calculate_order_change_1.OrderChangeProcessing.registerActionType(action_key_1.C
|
|
20
22
|
}
|
21
23
|
const existing = currentOrder.items.find((item) => item.id === refId);
|
22
24
|
if (!existing) {
|
23
|
-
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `
|
25
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Item ID "${refId}" not found.`);
|
24
26
|
}
|
25
27
|
if (!action.details?.quantity) {
|
26
28
|
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,2CAAgE;AAChE,8CAAgD;AAChD,sEAAiE;
|
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;AACjE,kEAA4D;AAE5D,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,QAAQ,CAAC,MAAM,CAAC,oBAAoB,KAAK,CAAC,CAAA;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;QAED,IAAA,yCAAkB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACtC,CAAC;IACD,MAAM,CAAC,EAAE,MAAM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CAAA;QACtE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,gDAAgD,CACjD,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { OrderChangeActionDTO } from "@medusajs/types";
|
2
|
+
import { OrderItem, OrderShippingMethod } from "../models";
|
3
|
+
export interface ApplyOrderChangeDTO extends OrderChangeActionDTO {
|
4
|
+
id: string;
|
5
|
+
order_id: string;
|
6
|
+
version: number;
|
7
|
+
applied: boolean;
|
8
|
+
}
|
9
|
+
export declare function applyChangesToOrder(orders: any[], actionsMap: Record<string, any[]>): {
|
10
|
+
itemsToUpsert: OrderItem[];
|
11
|
+
shippingMethodsToInsert: OrderShippingMethod[];
|
12
|
+
summariesToUpsert: any[];
|
13
|
+
orderToUpdate: any[];
|
14
|
+
};
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.applyChangesToOrder = void 0;
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
5
|
+
const calculate_order_change_1 = require("./calculate-order-change");
|
6
|
+
function applyChangesToOrder(orders, actionsMap) {
|
7
|
+
const itemsToUpsert = [];
|
8
|
+
const shippingMethodsToInsert = [];
|
9
|
+
const summariesToUpsert = [];
|
10
|
+
const orderToUpdate = [];
|
11
|
+
for (const order of orders) {
|
12
|
+
const calculated = (0, calculate_order_change_1.calculateOrderChange)({
|
13
|
+
order: order,
|
14
|
+
actions: actionsMap[order.id],
|
15
|
+
transactions: order.transactions ?? [],
|
16
|
+
});
|
17
|
+
(0, utils_1.createRawPropertiesFromBigNumber)(calculated);
|
18
|
+
const version = actionsMap[order.id][0].version ?? 1;
|
19
|
+
for (const item of calculated.order.items) {
|
20
|
+
const orderItem = item.detail ?? item;
|
21
|
+
const itemId = item.detail ? orderItem.item_id : item.id;
|
22
|
+
itemsToUpsert.push({
|
23
|
+
id: orderItem.version === version ? orderItem.id : undefined,
|
24
|
+
item_id: itemId,
|
25
|
+
order_id: order.id,
|
26
|
+
version,
|
27
|
+
quantity: orderItem.quantity,
|
28
|
+
fulfilled_quantity: orderItem.fulfilled_quantity,
|
29
|
+
shipped_quantity: orderItem.shipped_quantity,
|
30
|
+
return_requested_quantity: orderItem.return_requested_quantity,
|
31
|
+
return_received_quantity: orderItem.return_received_quantity,
|
32
|
+
return_dismissed_quantity: orderItem.return_dismissed_quantity,
|
33
|
+
written_off_quantity: orderItem.written_off_quantity,
|
34
|
+
metadata: orderItem.metadata,
|
35
|
+
});
|
36
|
+
}
|
37
|
+
const orderSummary = order.summary;
|
38
|
+
summariesToUpsert.push({
|
39
|
+
id: orderSummary?.version === version ? orderSummary.id : undefined,
|
40
|
+
order_id: order.id,
|
41
|
+
version,
|
42
|
+
totals: calculated.summary,
|
43
|
+
});
|
44
|
+
if (version > order.version) {
|
45
|
+
for (const shippingMethod of calculated.order.shipping_methods ?? []) {
|
46
|
+
if (!shippingMethod) {
|
47
|
+
continue;
|
48
|
+
}
|
49
|
+
const sm = {
|
50
|
+
...(shippingMethod.detail ?? shippingMethod),
|
51
|
+
version,
|
52
|
+
};
|
53
|
+
delete sm.id;
|
54
|
+
shippingMethodsToInsert.push(sm);
|
55
|
+
}
|
56
|
+
orderToUpdate.push({
|
57
|
+
selector: {
|
58
|
+
id: order.id,
|
59
|
+
},
|
60
|
+
data: {
|
61
|
+
version,
|
62
|
+
},
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
return {
|
67
|
+
itemsToUpsert,
|
68
|
+
shippingMethodsToInsert,
|
69
|
+
summariesToUpsert,
|
70
|
+
orderToUpdate,
|
71
|
+
};
|
72
|
+
}
|
73
|
+
exports.applyChangesToOrder = applyChangesToOrder;
|
74
|
+
//# sourceMappingURL=apply-order-changes.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ap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AAA;AACH,CAAC;AA/ED,kDA+EC"}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setFindMethods = void 0;
|
4
|
+
const core_1 = require("@mikro-orm/core");
|
5
|
+
const _models_1 = require("../models");
|
6
|
+
const _1 = require(".");
|
7
|
+
function setFindMethods(klass, entity) {
|
8
|
+
klass.prototype.find = async function find(options, context) {
|
9
|
+
const manager = this.getActiveManager(context);
|
10
|
+
const knex = manager.getKnex();
|
11
|
+
const findOptions_ = { ...options };
|
12
|
+
findOptions_.options ??= {};
|
13
|
+
findOptions_.where ??= {};
|
14
|
+
findOptions_.populate ??= [];
|
15
|
+
if (!("strategy" in findOptions_.options)) {
|
16
|
+
if (findOptions_.options.limit != null || findOptions_.options.offset) {
|
17
|
+
Object.assign(findOptions_.options, {
|
18
|
+
strategy: core_1.LoadStrategy.SELECT_IN,
|
19
|
+
});
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
Object.assign(findOptions_.options, {
|
23
|
+
strategy: core_1.LoadStrategy.JOINED,
|
24
|
+
});
|
25
|
+
}
|
26
|
+
}
|
27
|
+
const isRelatedEntity = entity !== _models_1.Order;
|
28
|
+
const config = (0, _1.mapRepositoryToOrderModel)(findOptions_, isRelatedEntity);
|
29
|
+
let orderAlias = "o0";
|
30
|
+
if (isRelatedEntity) {
|
31
|
+
// first relation is always order if the entity is not Order
|
32
|
+
config.options.populate.unshift("order");
|
33
|
+
orderAlias = "o1";
|
34
|
+
config.options.populate.unshift("order.items");
|
35
|
+
}
|
36
|
+
let defaultVersion = knex.raw(`"${orderAlias}"."version"`);
|
37
|
+
const strategy = config.options.strategy ?? core_1.LoadStrategy.JOINED;
|
38
|
+
if (strategy === core_1.LoadStrategy.SELECT_IN) {
|
39
|
+
const sql = manager
|
40
|
+
.qb(_models_1.Order, "_sub0")
|
41
|
+
.select("version")
|
42
|
+
.where({ id: knex.raw(`"${orderAlias}"."order_id"`) })
|
43
|
+
.getKnexQuery()
|
44
|
+
.toString();
|
45
|
+
defaultVersion = knex.raw(`(${sql})`);
|
46
|
+
}
|
47
|
+
const version = config.where.version ?? defaultVersion;
|
48
|
+
delete config.where?.version;
|
49
|
+
config.options.populateWhere ??= {};
|
50
|
+
const popWhere = config.options.populateWhere;
|
51
|
+
if (isRelatedEntity) {
|
52
|
+
popWhere.order ??= {};
|
53
|
+
}
|
54
|
+
const orderWhere = isRelatedEntity ? popWhere.order : popWhere;
|
55
|
+
orderWhere.summary ??= {};
|
56
|
+
orderWhere.summary.version = version;
|
57
|
+
orderWhere.items ??= {};
|
58
|
+
orderWhere.items.version = version;
|
59
|
+
popWhere.shipping_methods ??= {};
|
60
|
+
popWhere.shipping_methods.version = version;
|
61
|
+
if (!config.options.orderBy) {
|
62
|
+
config.options.orderBy = { id: "ASC" };
|
63
|
+
}
|
64
|
+
return await manager.find(entity, config.where, config.options);
|
65
|
+
};
|
66
|
+
klass.prototype.findAndCount = async function findAndCount(findOptions = { where: {} }, context = {}) {
|
67
|
+
const manager = this.getActiveManager(context);
|
68
|
+
const knex = manager.getKnex();
|
69
|
+
const findOptions_ = { ...findOptions };
|
70
|
+
findOptions_.options ??= {};
|
71
|
+
findOptions_.where ??= {};
|
72
|
+
if (!("strategy" in findOptions_.options)) {
|
73
|
+
Object.assign(findOptions_.options, {
|
74
|
+
strategy: core_1.LoadStrategy.SELECT_IN,
|
75
|
+
});
|
76
|
+
}
|
77
|
+
const isRelatedEntity = entity !== _models_1.Order;
|
78
|
+
const config = (0, _1.mapRepositoryToOrderModel)(findOptions_, isRelatedEntity);
|
79
|
+
let orderAlias = "o0";
|
80
|
+
if (isRelatedEntity) {
|
81
|
+
// first relation is always order if entity is not Order
|
82
|
+
config.options.populate.unshift("order");
|
83
|
+
orderAlias = "o1";
|
84
|
+
}
|
85
|
+
let defaultVersion = knex.raw(`"${orderAlias}"."version"`);
|
86
|
+
const strategy = config.options.strategy ?? core_1.LoadStrategy.JOINED;
|
87
|
+
if (strategy === core_1.LoadStrategy.SELECT_IN) {
|
88
|
+
const sql = manager
|
89
|
+
.qb(_models_1.Order, "_sub0")
|
90
|
+
.select("version")
|
91
|
+
.where({ id: knex.raw(`"${orderAlias}"."order_id"`) })
|
92
|
+
.getKnexQuery()
|
93
|
+
.toString();
|
94
|
+
defaultVersion = knex.raw(`(${sql})`);
|
95
|
+
}
|
96
|
+
const version = config.where.version ?? defaultVersion;
|
97
|
+
delete config.where.version;
|
98
|
+
config.options.populateWhere ??= {};
|
99
|
+
const popWhere = config.options.populateWhere;
|
100
|
+
if (isRelatedEntity) {
|
101
|
+
popWhere.order ??= {};
|
102
|
+
}
|
103
|
+
const orderWhere = isRelatedEntity ? popWhere.order : popWhere;
|
104
|
+
orderWhere.summary ??= {};
|
105
|
+
orderWhere.summary.version = version;
|
106
|
+
orderWhere.items ??= {};
|
107
|
+
orderWhere.items.version = version;
|
108
|
+
popWhere.shipping_methods ??= {};
|
109
|
+
popWhere.shipping_methods.version = version;
|
110
|
+
if (!config.options.orderBy) {
|
111
|
+
config.options.orderBy = { id: "ASC" };
|
112
|
+
}
|
113
|
+
return await manager.findAndCount(entity, config.where, config.options);
|
114
|
+
};
|
115
|
+
}
|
116
|
+
exports.setFindMethods = setFindMethods;
|
117
|
+
//# sourceMappingURL=base-repository-find.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base-repository-find.js","sourceRoot":"","sources":["../../src/utils/base-repository-find.ts"],"names":[],"mappings":";;;AACA,0CAA8C;AAC9C,qCAA+B;AAC/B,wBAA6C;AAE7C,SAAgB,cAAc,CAAI,KAAqB,EAAE,MAAW;IAClE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,KAAK,UAAU,IAAI,CAExC,OAA4B,EAC5B,OAAiB;QAEjB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAA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