@medusajs/order 0.1.3-snapshot-20240718083016 → 0.1.3-snapshot-20240719133408
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -26
- package/dist/index.js.map +1 -1
- package/dist/migrations/Migration20240219102530.d.ts +1 -0
- package/dist/migrations/Migration20240219102530.d.ts.map +1 -0
- package/dist/migrations/Migration20240219102530.js +38 -4
- package/dist/migrations/Migration20240219102530.js.map +1 -1
- package/dist/migrations/Migration20240604100512.d.ts +5 -0
- package/dist/migrations/Migration20240604100512.d.ts.map +1 -0
- package/dist/migrations/Migration20240604100512.js +364 -0
- package/dist/migrations/Migration20240604100512.js.map +1 -0
- package/dist/migrations/Migration20240715102100.d.ts +5 -0
- package/dist/migrations/Migration20240715102100.d.ts.map +1 -0
- package/dist/migrations/Migration20240715102100.js +15 -0
- package/dist/migrations/Migration20240715102100.js.map +1 -0
- package/dist/migrations/Migration20240715174100.d.ts +5 -0
- package/dist/migrations/Migration20240715174100.d.ts.map +1 -0
- package/dist/migrations/Migration20240715174100.js +21 -0
- package/dist/migrations/Migration20240715174100.js.map +1 -0
- package/dist/migrations/Migration20240716081800.d.ts +5 -0
- package/dist/migrations/Migration20240716081800.d.ts.map +1 -0
- package/dist/migrations/Migration20240716081800.js +67 -0
- package/dist/migrations/Migration20240716081800.js.map +1 -0
- package/dist/models/address.d.ts +2 -1
- package/dist/models/address.d.ts.map +1 -0
- package/dist/models/adjustment-line.d.ts +3 -1
- package/dist/models/adjustment-line.d.ts.map +1 -0
- package/dist/models/adjustment-line.js +5 -0
- package/dist/models/adjustment-line.js.map +1 -1
- package/dist/models/claim-item-image.d.ts +19 -0
- package/dist/models/claim-item-image.d.ts.map +1 -0
- package/dist/models/claim-item-image.js +109 -0
- package/dist/models/claim-item-image.js.map +1 -0
- package/dist/models/claim-item.d.ts +29 -0
- package/dist/models/claim-item.d.ts.map +1 -0
- package/dist/models/claim-item.js +156 -0
- package/dist/models/claim-item.js.map +1 -0
- package/dist/models/claim.d.ts +36 -0
- package/dist/models/claim.d.ts.map +1 -0
- package/dist/models/claim.js +195 -0
- package/dist/models/claim.js.map +1 -0
- package/dist/models/exchange-item.d.ts +24 -0
- package/dist/models/exchange-item.d.ts.map +1 -0
- package/dist/models/exchange-item.js +138 -0
- package/dist/models/exchange-item.js.map +1 -0
- package/dist/models/exchange.d.ts +34 -0
- package/dist/models/exchange.d.ts.map +1 -0
- package/dist/models/exchange.js +188 -0
- package/dist/models/exchange.js.map +1 -0
- package/dist/models/index.d.ts +9 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +17 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/line-item-adjustment.d.ts +3 -1
- package/dist/models/line-item-adjustment.d.ts.map +1 -0
- 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 +3 -1
- package/dist/models/line-item-tax-line.d.ts.map +1 -0
- 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 +3 -1
- package/dist/models/line-item.d.ts.map +1 -0
- package/dist/models/line-item.js +18 -4
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order-change-action.d.ts +15 -4
- package/dist/models/order-change-action.d.ts.map +1 -0
- package/dist/models/order-change-action.js +102 -7
- package/dist/models/order-change-action.js.map +1 -1
- package/dist/models/order-change.d.ts +17 -5
- package/dist/models/order-change.d.ts.map +1 -0
- package/dist/models/order-change.js +109 -4
- package/dist/models/order-change.js.map +1 -1
- package/dist/models/order-item.d.ts +5 -4
- package/dist/models/order-item.d.ts.map +1 -0
- 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 +14 -4
- package/dist/models/order-shipping-method.d.ts.map +1 -0
- package/dist/models/order-shipping-method.js +89 -13
- package/dist/models/order-shipping-method.js.map +1 -1
- package/dist/models/order-summary.d.ts +6 -7
- package/dist/models/order-summary.d.ts.map +1 -0
- package/dist/models/order-summary.js +9 -6
- package/dist/models/order-summary.js.map +1 -1
- package/dist/models/order.d.ts +6 -4
- package/dist/models/order.d.ts.map +1 -0
- package/dist/models/order.js +11 -1
- package/dist/models/order.js.map +1 -1
- package/dist/models/return-item.d.ts +29 -0
- package/dist/models/return-item.d.ts.map +1 -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 +21 -0
- package/dist/models/return-reason.d.ts.map +1 -0
- package/dist/models/return-reason.js +120 -0
- package/dist/models/return-reason.js.map +1 -0
- package/dist/models/return.d.ts +39 -0
- package/dist/models/return.d.ts.map +1 -0
- package/dist/models/return.js +216 -0
- package/dist/models/return.js.map +1 -0
- package/dist/models/shipping-method-adjustment.d.ts +3 -1
- package/dist/models/shipping-method-adjustment.d.ts.map +1 -0
- 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 +3 -1
- package/dist/models/shipping-method-tax-line.d.ts.map +1 -0
- 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 +2 -0
- package/dist/models/shipping-method.d.ts.map +1 -0
- package/dist/models/shipping-method.js +17 -4
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/tax-line.d.ts +2 -0
- package/dist/models/tax-line.d.ts.map +1 -0
- package/dist/models/tax-line.js +7 -0
- package/dist/models/tax-line.js.map +1 -1
- package/dist/models/transaction.d.ts +15 -3
- package/dist/models/transaction.d.ts.map +1 -0
- package/dist/models/transaction.js +109 -4
- package/dist/models/transaction.js.map +1 -1
- package/dist/repositories/claim.d.ts +9 -0
- package/dist/repositories/claim.d.ts.map +1 -0
- package/dist/repositories/claim.js +11 -0
- package/dist/repositories/claim.js.map +1 -0
- package/dist/repositories/exchange.d.ts +9 -0
- package/dist/repositories/exchange.d.ts.map +1 -0
- package/dist/repositories/exchange.js +11 -0
- package/dist/repositories/exchange.js.map +1 -0
- package/dist/repositories/index.d.ts +4 -1
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +7 -16
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/order.d.ts +1 -3
- package/dist/repositories/order.d.ts.map +1 -0
- package/dist/repositories/order.js +2 -85
- package/dist/repositories/order.js.map +1 -1
- package/dist/repositories/return.d.ts +9 -0
- package/dist/repositories/return.d.ts.map +1 -0
- package/dist/repositories/return.js +11 -0
- package/dist/repositories/return.js.map +1 -0
- package/dist/services/actions/cancel-claim.d.ts +3 -0
- package/dist/services/actions/cancel-claim.d.ts.map +1 -0
- package/dist/services/actions/cancel-claim.js +107 -0
- package/dist/services/actions/cancel-claim.js.map +1 -0
- package/dist/services/actions/cancel-exchange.d.ts +3 -0
- package/dist/services/actions/cancel-exchange.d.ts.map +1 -0
- package/dist/services/actions/cancel-exchange.js +92 -0
- package/dist/services/actions/cancel-exchange.js.map +1 -0
- package/dist/services/actions/cancel-fulfillment.d.ts +3 -0
- package/dist/services/actions/cancel-fulfillment.d.ts.map +1 -0
- package/dist/services/actions/cancel-fulfillment.js +32 -0
- package/dist/services/actions/cancel-fulfillment.js.map +1 -0
- package/dist/services/actions/cancel-return.d.ts +3 -0
- package/dist/services/actions/cancel-return.d.ts.map +1 -0
- package/dist/services/actions/cancel-return.js +72 -0
- package/dist/services/actions/cancel-return.js.map +1 -0
- package/dist/services/actions/create-claim.d.ts +3 -0
- package/dist/services/actions/create-claim.d.ts.map +1 -0
- package/dist/services/actions/create-claim.js +228 -0
- package/dist/services/actions/create-claim.js.map +1 -0
- package/dist/services/actions/create-exchange.d.ts +3 -0
- package/dist/services/actions/create-exchange.d.ts.map +1 -0
- package/dist/services/actions/create-exchange.js +193 -0
- package/dist/services/actions/create-exchange.js.map +1 -0
- package/dist/services/actions/create-return.d.ts +3 -0
- package/dist/services/actions/create-return.d.ts.map +1 -0
- package/dist/services/actions/create-return.js +102 -0
- package/dist/services/actions/create-return.js.map +1 -0
- package/dist/services/actions/index.d.ts +11 -0
- package/dist/services/actions/index.d.ts.map +1 -0
- package/dist/services/actions/index.js +27 -0
- package/dist/services/actions/index.js.map +1 -0
- package/dist/services/actions/receive-return.d.ts +3 -0
- package/dist/services/actions/receive-return.d.ts.map +1 -0
- package/dist/services/actions/receive-return.js +72 -0
- package/dist/services/actions/receive-return.js.map +1 -0
- package/dist/services/actions/register-fulfillment.d.ts +3 -0
- package/dist/services/actions/register-fulfillment.d.ts.map +1 -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 +3 -0
- package/dist/services/actions/register-shipment.d.ts.map +1 -0
- package/dist/services/actions/register-shipment.js +38 -0
- package/dist/services/actions/register-shipment.js.map +1 -0
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +1 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/order-module-service.d.ts +138 -67
- package/dist/services/order-module-service.d.ts.map +1 -0
- package/dist/services/order-module-service.js +993 -241
- package/dist/services/order-module-service.js.map +1 -1
- package/dist/services/order-service.d.ts +5 -4
- package/dist/services/order-service.d.ts.map +1 -0
- package/dist/services/order-service.js +1 -1
- package/dist/services/order-service.js.map +1 -1
- package/dist/types/address.d.ts +1 -0
- package/dist/types/address.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/line-item-adjustment.d.ts +1 -0
- package/dist/types/line-item-adjustment.d.ts.map +1 -0
- package/dist/types/line-item-tax-line.d.ts +1 -0
- package/dist/types/line-item-tax-line.d.ts.map +1 -0
- package/dist/types/line-item.d.ts +1 -0
- package/dist/types/line-item.d.ts.map +1 -0
- package/dist/types/order-change.d.ts +6 -0
- package/dist/types/order-change.d.ts.map +1 -0
- package/dist/types/order-change.js +3 -0
- package/dist/types/order-change.js.map +1 -0
- package/dist/types/order-detail.d.ts +2 -1
- package/dist/types/order-detail.d.ts.map +1 -0
- package/dist/types/order.d.ts +3 -2
- package/dist/types/order.d.ts.map +1 -0
- package/dist/types/shipping-method-adjustment.d.ts +1 -0
- package/dist/types/shipping-method-adjustment.d.ts.map +1 -0
- package/dist/types/shipping-method-tax-line.d.ts +1 -0
- package/dist/types/shipping-method-tax-line.d.ts.map +1 -0
- package/dist/types/shipping-method.d.ts +4 -0
- package/dist/types/shipping-method.d.ts.map +1 -0
- package/dist/types/tax-line.d.ts +1 -0
- package/dist/types/tax-line.d.ts.map +1 -0
- package/dist/types/transaction.d.ts +1 -0
- package/dist/types/transaction.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +40 -21
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/index.js +0 -1
- package/dist/types/utils/index.js.map +1 -1
- package/dist/utils/actions/cancel-item-fulfillment.d.ts +2 -0
- package/dist/utils/actions/cancel-item-fulfillment.d.ts.map +1 -0
- package/dist/utils/actions/cancel-item-fulfillment.js +34 -0
- package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -0
- package/dist/utils/actions/cancel-return.d.ts +1 -0
- package/dist/utils/actions/cancel-return.d.ts.map +1 -0
- package/dist/utils/actions/cancel-return.js +6 -10
- package/dist/utils/actions/cancel-return.js.map +1 -1
- package/dist/utils/actions/fulfill-item.d.ts +1 -0
- package/dist/utils/actions/fulfill-item.d.ts.map +1 -0
- package/dist/utils/actions/fulfill-item.js +6 -10
- package/dist/utils/actions/fulfill-item.js.map +1 -1
- package/dist/utils/actions/index.d.ts +4 -1
- package/dist/utils/actions/index.d.ts.map +1 -0
- package/dist/utils/actions/index.js +3 -1
- package/dist/utils/actions/index.js.map +1 -1
- package/dist/utils/actions/item-add.d.ts +1 -0
- package/dist/utils/actions/item-add.d.ts.map +1 -0
- package/dist/utils/actions/item-add.js +15 -24
- package/dist/utils/actions/item-add.js.map +1 -1
- package/dist/utils/actions/item-remove.d.ts +1 -0
- package/dist/utils/actions/item-remove.d.ts.map +1 -0
- package/dist/utils/actions/item-remove.js +8 -22
- package/dist/utils/actions/item-remove.js.map +1 -1
- package/dist/utils/actions/receive-damaged-return-item.d.ts +1 -0
- package/dist/utils/actions/receive-damaged-return-item.d.ts.map +1 -0
- package/dist/utils/actions/receive-damaged-return-item.js +9 -35
- package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
- package/dist/utils/actions/receive-return-item.d.ts +1 -0
- package/dist/utils/actions/receive-return-item.d.ts.map +1 -0
- package/dist/utils/actions/receive-return-item.js +7 -36
- package/dist/utils/actions/receive-return-item.js.map +1 -1
- package/dist/utils/actions/reinstate-item.d.ts +2 -0
- package/dist/utils/actions/reinstate-item.d.ts.map +1 -0
- package/dist/utils/actions/reinstate-item.js +32 -0
- package/dist/utils/actions/reinstate-item.js.map +1 -0
- package/dist/utils/actions/return-item.d.ts +1 -0
- package/dist/utils/actions/return-item.d.ts.map +1 -0
- package/dist/utils/actions/return-item.js +8 -12
- package/dist/utils/actions/return-item.js.map +1 -1
- package/dist/utils/actions/ship-item.d.ts +1 -0
- package/dist/utils/actions/ship-item.d.ts.map +1 -0
- package/dist/utils/actions/ship-item.js +6 -10
- package/dist/utils/actions/ship-item.js.map +1 -1
- package/dist/utils/actions/shipping-add.d.ts +1 -0
- package/dist/utils/actions/shipping-add.d.ts.map +1 -0
- package/dist/utils/actions/shipping-add.js +16 -16
- package/dist/utils/actions/shipping-add.js.map +1 -1
- package/dist/utils/actions/shipping-remove.d.ts +2 -0
- package/dist/utils/actions/shipping-remove.d.ts.map +1 -0
- package/dist/utils/actions/shipping-remove.js +25 -0
- package/dist/utils/actions/shipping-remove.js.map +1 -0
- package/dist/utils/actions/write-off-item.d.ts +1 -0
- package/dist/utils/actions/write-off-item.d.ts.map +1 -0
- package/dist/utils/actions/write-off-item.js +6 -10
- package/dist/utils/actions/write-off-item.js.map +1 -1
- package/dist/utils/apply-order-changes.d.ts +18 -0
- package/dist/utils/apply-order-changes.d.ts.map +1 -0
- package/dist/utils/apply-order-changes.js +95 -0
- package/dist/utils/apply-order-changes.js.map +1 -0
- package/dist/utils/base-repository-find.d.ts +3 -0
- package/dist/utils/base-repository-find.d.ts.map +1 -0
- package/dist/utils/base-repository-find.js +142 -0
- package/dist/utils/base-repository-find.js.map +1 -0
- package/dist/utils/calculate-order-change.d.ts +11 -5
- package/dist/utils/calculate-order-change.d.ts.map +1 -0
- package/dist/utils/calculate-order-change.js +58 -183
- package/dist/utils/calculate-order-change.js.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/set-action-reference.d.ts +2 -0
- package/dist/utils/set-action-reference.d.ts.map +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 +4 -2
- package/dist/utils/transform-order.d.ts.map +1 -0
- package/dist/utils/transform-order.js +131 -17
- package/dist/utils/transform-order.js.map +1 -1
- package/package.json +8 -14
- package/dist/joiner-config.d.ts +0 -5
- package/dist/joiner-config.js +0 -36
- package/dist/joiner-config.js.map +0 -1
- package/dist/module-definition.d.ts +0 -2
- package/dist/module-definition.js +0 -59
- 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
- package/dist/services/order-change-service.d.ts +0 -15
- package/dist/services/order-change-service.js +0 -96
- package/dist/services/order-change-service.js.map +0 -1
- package/dist/utils/action-key.d.ts +0 -13
- package/dist/utils/action-key.js +0 -18
- package/dist/utils/action-key.js.map +0 -1
- package/dist/utils/actions/cancel.d.ts +0 -1
- package/dist/utils/actions/cancel.js +0 -8
- package/dist/utils/actions/cancel.js.map +0 -1
@@ -1,35 +1,41 @@
|
|
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
|
+
}
|
3
7
|
export declare class OrderChangeProcessing {
|
4
8
|
private static typeDefinition;
|
5
9
|
private static defaultConfig;
|
6
10
|
private order;
|
7
11
|
private transactions;
|
8
12
|
private actions;
|
13
|
+
private options;
|
9
14
|
private actionsProcessed;
|
10
15
|
private groupTotal;
|
11
16
|
private summary;
|
12
17
|
static registerActionType(key: string, type: ActionTypeDefinition): void;
|
13
|
-
constructor({ order, transactions, actions, }: {
|
18
|
+
constructor({ order, transactions, actions, options, }: {
|
14
19
|
order: VirtualOrder;
|
15
20
|
transactions: OrderTransaction[];
|
16
21
|
actions: InternalOrderChangeEvent[];
|
22
|
+
options: ProcessOptions;
|
17
23
|
});
|
18
24
|
private isEventActive;
|
19
25
|
private isEventDone;
|
20
|
-
private isEventPending;
|
21
26
|
processActions(): void;
|
22
27
|
private processAction_;
|
23
|
-
private resolveReferences;
|
24
|
-
private resolveGroup;
|
25
28
|
getSummary(): OrderSummaryDTO;
|
26
29
|
getCurrentOrder(): VirtualOrder;
|
27
30
|
}
|
28
|
-
export declare function calculateOrderChange({ order, transactions, actions, }: {
|
31
|
+
export declare function calculateOrderChange({ order, transactions, actions, options, }: {
|
29
32
|
order: VirtualOrder;
|
30
33
|
transactions?: OrderTransaction[];
|
31
34
|
actions?: OrderChangeEvent[];
|
35
|
+
options?: ProcessOptions;
|
32
36
|
}): {
|
33
37
|
summary: OrderSummaryDTO;
|
34
38
|
order: VirtualOrder;
|
35
39
|
};
|
40
|
+
export {};
|
41
|
+
//# sourceMappingURL=calculate-order-change.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3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EAAE,gBAAgB,EAAE,CAAA;IACjC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB;;;EAaA"}
|
@@ -7,24 +7,36 @@ class OrderChangeProcessing {
|
|
7
7
|
static registerActionType(key, type) {
|
8
8
|
OrderChangeProcessing.typeDefinition[key] = type;
|
9
9
|
}
|
10
|
-
constructor({ order, transactions, actions, }) {
|
10
|
+
constructor({ order, transactions, actions, options, }) {
|
11
|
+
this.options = {};
|
11
12
|
this.actionsProcessed = {};
|
12
13
|
this.groupTotal = {};
|
13
14
|
this.order = JSON.parse(JSON.stringify(order));
|
14
15
|
this.transactions = JSON.parse(JSON.stringify(transactions ?? []));
|
15
16
|
this.actions = JSON.parse(JSON.stringify(actions ?? []));
|
16
|
-
|
17
|
+
this.options = options;
|
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
|
+
}
|
17
30
|
(0, utils_1.transformPropertiesToBigNumber)(this.order.metadata);
|
18
31
|
this.summary = {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
transactionTotal,
|
32
|
+
temporary_difference: 0,
|
33
|
+
pending_difference: 0,
|
34
|
+
difference_sum: 0,
|
35
|
+
current_order_total: this.order.total ?? 0,
|
36
|
+
original_order_total: this.order.total ?? 0,
|
37
|
+
transaction_total: transactionTotal,
|
38
|
+
paid_total: paid,
|
39
|
+
refunded_total: refunded,
|
28
40
|
};
|
29
41
|
}
|
30
42
|
isEventActive(action) {
|
@@ -37,12 +49,7 @@ class OrderChangeProcessing {
|
|
37
49
|
const status = action.status;
|
38
50
|
return status === _types_1.EVENT_STATUS.DONE;
|
39
51
|
}
|
40
|
-
isEventPending(action) {
|
41
|
-
const status = action.status;
|
42
|
-
return status === undefined || status === _types_1.EVENT_STATUS.PENDING;
|
43
|
-
}
|
44
52
|
processActions() {
|
45
|
-
var _a, _b;
|
46
53
|
for (const action of this.actions) {
|
47
54
|
this.processAction_(action);
|
48
55
|
}
|
@@ -56,59 +63,46 @@ class OrderChangeProcessing {
|
|
56
63
|
...OrderChangeProcessing.typeDefinition[action.action],
|
57
64
|
};
|
58
65
|
const amount = utils_1.MathBN.mult(action.amount, type.isDeduction ? -1 : 1);
|
59
|
-
if (action.
|
60
|
-
|
61
|
-
this.groupTotal[action.
|
66
|
+
if (action.change_id) {
|
67
|
+
this.groupTotal[action.change_id] ??= 0;
|
68
|
+
this.groupTotal[action.change_id] = utils_1.MathBN.add(this.groupTotal[action.change_id], amount);
|
62
69
|
}
|
63
|
-
if (type.awaitRequired
|
64
|
-
|
65
|
-
summary.futureTemporarySum = utils_1.MathBN.add(summary.futureTemporarySum, amount);
|
66
|
-
}
|
67
|
-
else {
|
68
|
-
summary.temporaryDifference = utils_1.MathBN.add(summary.temporaryDifference, amount);
|
69
|
-
}
|
70
|
+
if (type.awaitRequired) {
|
71
|
+
summary.temporary_difference = utils_1.MathBN.add(summary.temporary_difference, amount);
|
70
72
|
}
|
71
|
-
if (action.
|
72
|
-
summary.
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
if (!this.isEventDone(action) && !action.group_id) {
|
76
|
-
summary.differenceSum = utils_1.MathBN.add(summary.differenceSum, amount);
|
77
|
-
}
|
78
|
-
summary.currentOrderTotal = utils_1.MathBN.add(summary.currentOrderTotal, amount);
|
73
|
+
if (!this.isEventDone(action) && !action.change_id) {
|
74
|
+
summary.difference_sum = utils_1.MathBN.add(summary.difference_sum, amount);
|
79
75
|
}
|
76
|
+
summary.current_order_total = utils_1.MathBN.add(summary.current_order_total, amount);
|
80
77
|
}
|
81
78
|
const groupSum = utils_1.MathBN.add(...Object.values(this.groupTotal));
|
82
|
-
summary.
|
83
|
-
summary.
|
84
|
-
summary.
|
85
|
-
summary.
|
86
|
-
summary.pendingDifference = utils_1.MathBN.sub(summary.currentOrderTotal, summary.transactionTotal);
|
79
|
+
summary.difference_sum = utils_1.MathBN.add(summary.difference_sum, groupSum);
|
80
|
+
summary.transaction_total = utils_1.MathBN.sum(...this.transactions.map((tr) => tr.amount));
|
81
|
+
summary.temporary_difference = utils_1.MathBN.sub(summary.difference_sum, summary.temporary_difference);
|
82
|
+
summary.pending_difference = utils_1.MathBN.sub(summary.current_order_total, summary.transaction_total);
|
87
83
|
}
|
88
84
|
processAction_(action, isReplay = false) {
|
89
|
-
|
85
|
+
const definedType = OrderChangeProcessing.typeDefinition[action.action];
|
86
|
+
if (!(0, utils_1.isPresent)(definedType)) {
|
87
|
+
throw new Error(`Action type ${action.action} is not defined`);
|
88
|
+
}
|
90
89
|
const type = {
|
91
90
|
...OrderChangeProcessing.defaultConfig,
|
92
|
-
...
|
91
|
+
...definedType,
|
93
92
|
};
|
94
|
-
|
93
|
+
this.actionsProcessed[action.action] ??= [];
|
95
94
|
if (!isReplay) {
|
96
95
|
this.actionsProcessed[action.action].push(action);
|
97
96
|
}
|
98
|
-
let previousEvents;
|
99
|
-
if (type.commitsAction) {
|
100
|
-
previousEvents = (this.actionsProcessed[type.commitsAction] ?? []).filter((ac_) => ac_.reference_id === action.reference_id &&
|
101
|
-
ac_.status !== _types_1.EVENT_STATUS.VOIDED);
|
102
|
-
}
|
103
97
|
let calculatedAmount = action.amount ?? 0;
|
104
98
|
const params = {
|
105
99
|
actions: this.actions,
|
106
100
|
action,
|
107
|
-
previousEvents,
|
108
101
|
currentOrder: this.order,
|
109
102
|
summary: this.summary,
|
110
103
|
transactions: this.transactions,
|
111
104
|
type,
|
105
|
+
options: this.options,
|
112
106
|
};
|
113
107
|
if (typeof type.validate === "function") {
|
114
108
|
type.validate(params);
|
@@ -116,147 +110,24 @@ class OrderChangeProcessing {
|
|
116
110
|
if (typeof type.operation === "function") {
|
117
111
|
calculatedAmount = type.operation(params);
|
118
112
|
// the action.amount has priority over the calculated amount
|
119
|
-
if (
|
113
|
+
if (action.amount == undefined) {
|
120
114
|
action.amount = calculatedAmount ?? 0;
|
121
115
|
}
|
122
116
|
}
|
123
|
-
// If an action commits previous ones, replay them with updated values
|
124
|
-
if (type.commitsAction) {
|
125
|
-
for (const previousEvent of previousEvents ?? []) {
|
126
|
-
this.processAction_(previousEvent, true);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
if (action.resolve) {
|
130
|
-
if (action.resolve.reference_id) {
|
131
|
-
this.resolveReferences(action);
|
132
|
-
}
|
133
|
-
const groupId = action.resolve.group_id ?? "__default";
|
134
|
-
if (action.resolve.group_id) {
|
135
|
-
// resolve all actions in the same group
|
136
|
-
this.resolveGroup(action);
|
137
|
-
}
|
138
|
-
if (action.resolve.amount && !action.evaluationOnly) {
|
139
|
-
(_c = this.groupTotal)[groupId] ?? (_c[groupId] = 0);
|
140
|
-
this.groupTotal[groupId] = utils_1.MathBN.sub(this.groupTotal[groupId], action.resolve.amount);
|
141
|
-
}
|
142
|
-
}
|
143
117
|
return calculatedAmount;
|
144
118
|
}
|
145
|
-
resolveReferences(self) {
|
146
|
-
const resolve = self.resolve;
|
147
|
-
const resolveType = OrderChangeProcessing.typeDefinition[self.action];
|
148
|
-
Object.keys(this.actionsProcessed).forEach((actionKey) => {
|
149
|
-
const type = OrderChangeProcessing.typeDefinition[actionKey];
|
150
|
-
const actions = this.actionsProcessed[actionKey];
|
151
|
-
for (const action of actions) {
|
152
|
-
if (action === self ||
|
153
|
-
!this.isEventPending(action) ||
|
154
|
-
action.reference_id !== resolve?.reference_id) {
|
155
|
-
continue;
|
156
|
-
}
|
157
|
-
if (type.revert && (action.evaluationOnly || resolveType.void)) {
|
158
|
-
let previousEvents;
|
159
|
-
if (type.commitsAction) {
|
160
|
-
previousEvents = (this.actionsProcessed[type.commitsAction] ?? []).filter((ac_) => ac_.reference_id === action.reference_id &&
|
161
|
-
ac_.status !== _types_1.EVENT_STATUS.VOIDED);
|
162
|
-
}
|
163
|
-
type.revert({
|
164
|
-
actions: this.actions,
|
165
|
-
action,
|
166
|
-
previousEvents,
|
167
|
-
currentOrder: this.order,
|
168
|
-
summary: this.summary,
|
169
|
-
transactions: this.transactions,
|
170
|
-
type,
|
171
|
-
});
|
172
|
-
for (const previousEvent of previousEvents ?? []) {
|
173
|
-
this.processAction_(previousEvent, true);
|
174
|
-
}
|
175
|
-
action.status =
|
176
|
-
action.evaluationOnly || resolveType.void
|
177
|
-
? _types_1.EVENT_STATUS.VOIDED
|
178
|
-
: _types_1.EVENT_STATUS.DONE;
|
179
|
-
}
|
180
|
-
}
|
181
|
-
});
|
182
|
-
}
|
183
|
-
resolveGroup(self) {
|
184
|
-
const resolve = self.resolve;
|
185
|
-
Object.keys(this.actionsProcessed).forEach((actionKey) => {
|
186
|
-
const type = OrderChangeProcessing.typeDefinition[actionKey];
|
187
|
-
const actions = this.actionsProcessed[actionKey];
|
188
|
-
for (const action of actions) {
|
189
|
-
if (!resolve?.group_id || action?.group_id !== resolve.group_id) {
|
190
|
-
continue;
|
191
|
-
}
|
192
|
-
if (type.revert &&
|
193
|
-
action.status !== _types_1.EVENT_STATUS.DONE &&
|
194
|
-
action.status !== _types_1.EVENT_STATUS.VOIDED &&
|
195
|
-
(action.evaluationOnly || type.void)) {
|
196
|
-
let previousEvents;
|
197
|
-
if (type.commitsAction) {
|
198
|
-
previousEvents = (this.actionsProcessed[type.commitsAction] ?? []).filter((ac_) => ac_.reference_id === action.reference_id &&
|
199
|
-
ac_.status !== _types_1.EVENT_STATUS.VOIDED);
|
200
|
-
}
|
201
|
-
type.revert({
|
202
|
-
actions: this.actions,
|
203
|
-
action: action,
|
204
|
-
previousEvents,
|
205
|
-
currentOrder: this.order,
|
206
|
-
summary: this.summary,
|
207
|
-
transactions: this.transactions,
|
208
|
-
type: OrderChangeProcessing.typeDefinition[action.action],
|
209
|
-
});
|
210
|
-
for (const previousEvent of previousEvents ?? []) {
|
211
|
-
this.processAction_(previousEvent, true);
|
212
|
-
}
|
213
|
-
action.status =
|
214
|
-
action.evaluationOnly || type.void
|
215
|
-
? _types_1.EVENT_STATUS.VOIDED
|
216
|
-
: _types_1.EVENT_STATUS.DONE;
|
217
|
-
}
|
218
|
-
}
|
219
|
-
});
|
220
|
-
}
|
221
119
|
getSummary() {
|
222
120
|
const summary = this.summary;
|
223
121
|
const orderSummary = {
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
122
|
+
transaction_total: new utils_1.BigNumber(summary.transaction_total),
|
123
|
+
original_order_total: new utils_1.BigNumber(summary.original_order_total),
|
124
|
+
current_order_total: new utils_1.BigNumber(summary.current_order_total),
|
125
|
+
temporary_difference: new utils_1.BigNumber(summary.temporary_difference),
|
126
|
+
pending_difference: new utils_1.BigNumber(summary.pending_difference),
|
127
|
+
difference_sum: new utils_1.BigNumber(summary.difference_sum),
|
128
|
+
paid_total: new utils_1.BigNumber(summary.paid_total),
|
129
|
+
refunded_total: new utils_1.BigNumber(summary.refunded_total),
|
232
130
|
};
|
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
|
-
*/
|
260
131
|
return orderSummary;
|
261
132
|
}
|
262
133
|
getCurrentOrder() {
|
@@ -266,11 +137,15 @@ class OrderChangeProcessing {
|
|
266
137
|
exports.OrderChangeProcessing = OrderChangeProcessing;
|
267
138
|
OrderChangeProcessing.typeDefinition = {};
|
268
139
|
OrderChangeProcessing.defaultConfig = {
|
269
|
-
awaitRequired: false,
|
270
140
|
isDeduction: false,
|
271
141
|
};
|
272
|
-
function calculateOrderChange({ order, transactions = [], actions = [], }) {
|
273
|
-
const calc = new OrderChangeProcessing({
|
142
|
+
function calculateOrderChange({ order, transactions = [], actions = [], options = {}, }) {
|
143
|
+
const calc = new OrderChangeProcessing({
|
144
|
+
order,
|
145
|
+
transactions,
|
146
|
+
actions,
|
147
|
+
options,
|
148
|
+
});
|
274
149
|
calc.processActions();
|
275
150
|
return {
|
276
151
|
summary: calc.getSummary(),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"calculate-order-change.js","sourceRoot":"","sources":["../../src/utils/calculate-order-change.ts"],"names":[],"mappings":";;;AACA,2CAKwB;AACxB,mCAQe;
|
1
|
+
{"version":3,"file":"calculate-order-change.js","sourceRoot":"","sources":["../../src/utils/calculate-order-change.ts"],"names":[],"mappings":";;;AACA,2CAKwB;AACxB,mCAQe;AAOf,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,EACP,OAAO,GAMR;QApBO,YAAO,GAAmB,EAAE,CAAA;QAE5B,qBAAgB,GAAkD,EAAE,CAAA;QACpE,eAAU,GAAmC,EAAE,CAAA;QAkBrD,IAAI,CAAC,KAAK,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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"}
|
package/dist/utils/index.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA"}
|
package/dist/utils/index.js
CHANGED
@@ -14,7 +14,9 @@ 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);
|
18
17
|
__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);
|
20
22
|
//# 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
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,wDAAqC;AACrC,2DAAwC;AACxC,yDAAsC;AACtC,oDAAiC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"set-action-reference.d.ts","sourceRoot":"","sources":["../../src/utils/set-action-reference.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,QAAQ,KAAA,EAAE,MAAM,KAAA,EAAE,OAAO,KAAA,QAK3D"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setActionReference = void 0;
|
4
|
+
function setActionReference(existing, action, options) {
|
5
|
+
if (options?.addActionReferenceToObject) {
|
6
|
+
existing.actions ??= [];
|
7
|
+
existing.actions.push(action);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.setActionReference = setActionReference;
|
11
|
+
//# sourceMappingURL=set-action-reference.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"set-action-reference.js","sourceRoot":"","sources":["../../src/utils/set-action-reference.ts"],"names":[],"mappings":";;;AAAA,SAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO;IAC1D,IAAI,OAAO,EAAE,0BAA0B,EAAE,CAAC;QACxC,QAAQ,CAAC,OAAO,KAAK,EAAE,CAAA;QACvB,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC/B,CAAC;AACH,CAAC;AALD,gDAKC"}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { OrderTypes } from "@medusajs/types";
|
2
2
|
export declare function formatOrder(order: any, options: {
|
3
|
+
entity: any;
|
3
4
|
includeTotals?: boolean;
|
4
|
-
}): OrderTypes.OrderDTO | OrderTypes.OrderDTO[];
|
5
|
-
export declare function mapRepositoryToOrderModel(config: any): any;
|
5
|
+
}): Partial<OrderTypes.OrderDTO> | Partial<OrderTypes.OrderDTO>[];
|
6
|
+
export declare function mapRepositoryToOrderModel(config: any, isRelatedEntity?: boolean): any;
|
7
|
+
//# sourceMappingURL=transform-order.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"transform-order.d.ts","sourceRoot":"","sources":["../../src/utils/transform-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAU5C,wBAAgB,WAAW,CACzB,KAAK,KAAA,EACL,OAAO,EAAE;IACP,MAAM,EAAE,GAAG,CAAA;IACX,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,GACA,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAkF/D;AAmFD,wBAAgB,yBAAyB,CAAC,MAAM,KAAA,EAAE,eAAe,UAAQ,OAwExE"}
|