@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
@@ -1,10 +1,33 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
21
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
23
|
};
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
25
|
+
if (mod && mod.__esModule) return mod;
|
26
|
+
var result = {};
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
28
|
+
__setModuleDefault(result, mod);
|
29
|
+
return result;
|
30
|
+
};
|
8
31
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
32
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
33
|
};
|
@@ -15,27 +38,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
38
|
const types_1 = require("@medusajs/types");
|
16
39
|
const utils_1 = require("@medusajs/utils");
|
17
40
|
const _models_1 = require("../models");
|
41
|
+
const _types_1 = require("../types");
|
18
42
|
const joiner_config_1 = require("../joiner-config");
|
19
43
|
const utils_2 = require("../utils");
|
20
|
-
const
|
21
|
-
const generateMethodForModels =
|
22
|
-
_models_1.
|
23
|
-
_models_1.
|
24
|
-
_models_1.
|
25
|
-
_models_1.
|
26
|
-
_models_1.
|
27
|
-
_models_1.
|
28
|
-
_models_1.
|
29
|
-
_models_1.
|
30
|
-
_models_1.
|
31
|
-
_models_1.
|
32
|
-
_models_1.
|
33
|
-
_models_1.
|
34
|
-
_models_1.
|
35
|
-
_models_1.
|
36
|
-
|
37
|
-
|
38
|
-
|
44
|
+
const BundledActions = __importStar(require("./actions"));
|
45
|
+
const generateMethodForModels = {
|
46
|
+
Order: _models_1.Order,
|
47
|
+
Address: _models_1.Address,
|
48
|
+
LineItem: _models_1.LineItem,
|
49
|
+
LineItemAdjustment: _models_1.LineItemAdjustment,
|
50
|
+
LineItemTaxLine: _models_1.LineItemTaxLine,
|
51
|
+
ShippingMethod: _models_1.ShippingMethod,
|
52
|
+
ShippingMethodAdjustment: _models_1.ShippingMethodAdjustment,
|
53
|
+
ShippingMethodTaxLine: _models_1.ShippingMethodTaxLine,
|
54
|
+
Transaction: _models_1.Transaction,
|
55
|
+
OrderChange: _models_1.OrderChange,
|
56
|
+
OrderChangeAction: _models_1.OrderChangeAction,
|
57
|
+
OrderItem: _models_1.OrderItem,
|
58
|
+
OrderSummary: _models_1.OrderSummary,
|
59
|
+
OrderShippingMethod: _models_1.OrderShippingMethod,
|
60
|
+
ReturnReason: _models_1.ReturnReason,
|
61
|
+
Return: _models_1.Return,
|
62
|
+
ReturnItem: _models_1.ReturnItem,
|
63
|
+
OrderClaim: _models_1.OrderClaim,
|
64
|
+
OrderExchange: _models_1.OrderExchange,
|
65
|
+
};
|
66
|
+
// TODO: rm template args here, keep it for later to not collide with carlos work at least as little as possible
|
67
|
+
class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateMethodForModels, joiner_config_1.entityNameToLinkableKeysMap) {
|
68
|
+
constructor({ baseRepository, orderService, addressService, lineItemService, shippingMethodAdjustmentService, shippingMethodService, lineItemAdjustmentService, shippingMethodTaxLineService, lineItemTaxLineService, transactionService, orderChangeService, orderChangeActionService, orderItemService, orderSummaryService, orderShippingMethodService, returnReasonService, returnService, returnItemService, orderClaimService, orderExchangeService, }, moduleDeclaration) {
|
39
69
|
// @ts-ignore
|
40
70
|
super(...arguments);
|
41
71
|
this.moduleDeclaration = moduleDeclaration;
|
@@ -55,6 +85,10 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
55
85
|
this.orderSummaryService_ = orderSummaryService;
|
56
86
|
this.orderShippingMethodService_ = orderShippingMethodService;
|
57
87
|
this.returnReasonService_ = returnReasonService;
|
88
|
+
this.returnService_ = returnService;
|
89
|
+
this.returnItemService_ = returnItemService;
|
90
|
+
this.orderClaimService_ = orderClaimService;
|
91
|
+
this.orderExchangeService_ = orderExchangeService;
|
58
92
|
}
|
59
93
|
__joinerConfig() {
|
60
94
|
return joiner_config_1.joinerConfig;
|
@@ -106,33 +140,142 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
106
140
|
return (!requiredFieldsForTotals.some((val) => val.startsWith(field)) && !totalFields.includes(field));
|
107
141
|
});
|
108
142
|
}
|
109
|
-
|
143
|
+
// @ts-expect-error
|
144
|
+
async retrieveOrder(id, config, sharedContext) {
|
145
|
+
config ??= {};
|
146
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
147
|
+
const order = await super.retrieveOrder(id, config, sharedContext);
|
148
|
+
return (0, utils_2.formatOrder)(order, {
|
149
|
+
entity: _models_1.Order,
|
150
|
+
includeTotals,
|
151
|
+
});
|
152
|
+
}
|
153
|
+
// @ts-expect-error
|
154
|
+
async listOrders(filters, config, sharedContext) {
|
155
|
+
config ??= {};
|
156
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
157
|
+
const orders = await super.listOrders(filters, config, sharedContext);
|
158
|
+
return (0, utils_2.formatOrder)(orders, {
|
159
|
+
entity: _models_1.Order,
|
160
|
+
includeTotals,
|
161
|
+
});
|
162
|
+
}
|
163
|
+
// @ts-expect-error
|
164
|
+
async listAndCountOrders(filters, config, sharedContext) {
|
165
|
+
config ??= {};
|
166
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
167
|
+
const [orders, count] = await super.listAndCountOrders(filters, config, sharedContext);
|
168
|
+
return [
|
169
|
+
(0, utils_2.formatOrder)(orders, {
|
170
|
+
entity: _models_1.Order,
|
171
|
+
includeTotals,
|
172
|
+
}),
|
173
|
+
count,
|
174
|
+
];
|
175
|
+
}
|
176
|
+
// @ts-ignore
|
177
|
+
async retrieveReturn(id, config, sharedContext) {
|
178
|
+
config ??= {};
|
179
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
180
|
+
const returnOrder = await super.retrieveReturn(id, config, sharedContext);
|
181
|
+
return (0, utils_2.formatOrder)(returnOrder, {
|
182
|
+
entity: _models_1.Return,
|
183
|
+
includeTotals,
|
184
|
+
});
|
185
|
+
}
|
186
|
+
// @ts-ignore
|
187
|
+
async listReturns(filters, config, sharedContext) {
|
188
|
+
config ??= {};
|
189
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
190
|
+
const returnOrders = await super.listReturns(filters, config, sharedContext);
|
191
|
+
return (0, utils_2.formatOrder)(returnOrders, {
|
192
|
+
entity: _models_1.Return,
|
193
|
+
includeTotals,
|
194
|
+
});
|
195
|
+
}
|
196
|
+
// @ts-ignore
|
197
|
+
async listAndCountReturns(filters, config, sharedContext) {
|
198
|
+
config ??= {};
|
199
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
200
|
+
const [returnOrders, count] = await super.listAndCountReturns(filters, config, sharedContext);
|
201
|
+
return [
|
202
|
+
(0, utils_2.formatOrder)(returnOrders, {
|
203
|
+
entity: _models_1.Return,
|
204
|
+
includeTotals,
|
205
|
+
}),
|
206
|
+
count,
|
207
|
+
];
|
208
|
+
}
|
209
|
+
// @ts-ignore
|
210
|
+
async retrieveOrderClaim(id, config, sharedContext) {
|
211
|
+
config ??= {};
|
212
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
213
|
+
const returnOrder = await super.retrieveOrderClaim(id, config, sharedContext);
|
214
|
+
return (0, utils_2.formatOrder)(returnOrder, {
|
215
|
+
entity: _models_1.OrderClaim,
|
216
|
+
includeTotals,
|
217
|
+
});
|
218
|
+
}
|
219
|
+
// @ts-ignore
|
220
|
+
async listOrderClaims(filters, config, sharedContext) {
|
110
221
|
config ??= {};
|
111
222
|
const includeTotals = this.shouldIncludeTotals(config);
|
112
|
-
const
|
113
|
-
return (0,
|
223
|
+
const returnOrders = await super.listOrderClaims(filters, config, sharedContext);
|
224
|
+
return (0, utils_2.formatOrder)(returnOrders, {
|
225
|
+
entity: _models_1.OrderClaim,
|
226
|
+
includeTotals,
|
227
|
+
});
|
114
228
|
}
|
115
|
-
|
229
|
+
// @ts-ignore
|
230
|
+
async listAndCountOrderClaims(filters, config, sharedContext) {
|
116
231
|
config ??= {};
|
117
232
|
const includeTotals = this.shouldIncludeTotals(config);
|
118
|
-
const
|
119
|
-
return
|
233
|
+
const [returnOrders, count] = await super.listAndCountOrderClaims(filters, config, sharedContext);
|
234
|
+
return [
|
235
|
+
(0, utils_2.formatOrder)(returnOrders, {
|
236
|
+
entity: _models_1.OrderClaim,
|
237
|
+
includeTotals,
|
238
|
+
}),
|
239
|
+
count,
|
240
|
+
];
|
241
|
+
}
|
242
|
+
// @ts-ignore
|
243
|
+
async retrieveOrderExchange(id, config, sharedContext) {
|
244
|
+
config ??= {};
|
245
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
246
|
+
const returnOrder = await super.retrieveOrderExchange(id, config, sharedContext);
|
247
|
+
return (0, utils_2.formatOrder)(returnOrder, {
|
248
|
+
entity: _models_1.OrderExchange,
|
249
|
+
includeTotals,
|
250
|
+
});
|
251
|
+
}
|
252
|
+
// @ts-ignore
|
253
|
+
async listOrderExchanges(filters, config, sharedContext) {
|
254
|
+
config ??= {};
|
255
|
+
const includeTotals = this.shouldIncludeTotals(config);
|
256
|
+
const returnOrders = await super.listOrderExchanges(filters, config, sharedContext);
|
257
|
+
return (0, utils_2.formatOrder)(returnOrders, {
|
258
|
+
entity: _models_1.OrderExchange,
|
120
259
|
includeTotals,
|
121
260
|
});
|
122
261
|
}
|
123
|
-
|
262
|
+
// @ts-ignore
|
263
|
+
async listAndCountOrderExchanges(filters, config, sharedContext) {
|
124
264
|
config ??= {};
|
125
265
|
const includeTotals = this.shouldIncludeTotals(config);
|
126
|
-
const [
|
266
|
+
const [returnOrders, count] = await super.listAndCountOrderExchanges(filters, config, sharedContext);
|
127
267
|
return [
|
128
|
-
(0,
|
268
|
+
(0, utils_2.formatOrder)(returnOrders, {
|
269
|
+
entity: _models_1.OrderExchange,
|
270
|
+
includeTotals,
|
271
|
+
}),
|
129
272
|
count,
|
130
273
|
];
|
131
274
|
}
|
132
|
-
async
|
275
|
+
async createOrders(data, sharedContext = {}) {
|
133
276
|
const input = Array.isArray(data) ? data : [data];
|
134
|
-
const orders = await this.
|
135
|
-
const result = await this.
|
277
|
+
const orders = await this.createOrders_(input, sharedContext);
|
278
|
+
const result = await this.listOrders({
|
136
279
|
id: orders.map((p) => p.id),
|
137
280
|
}, {
|
138
281
|
relations: [
|
@@ -150,7 +293,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
150
293
|
}, sharedContext);
|
151
294
|
return (Array.isArray(data) ? result : result[0]);
|
152
295
|
}
|
153
|
-
async
|
296
|
+
async createOrders_(data, sharedContext = {}) {
|
154
297
|
const lineItemsToCreate = [];
|
155
298
|
const createdOrders = [];
|
156
299
|
for (const { items, shipping_methods, ...order } of data) {
|
@@ -191,14 +334,14 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
191
334
|
}
|
192
335
|
return createdOrders;
|
193
336
|
}
|
194
|
-
async
|
195
|
-
const result = await this.
|
337
|
+
async updateOrders(dataOrIdOrSelector, data, sharedContext = {}) {
|
338
|
+
const result = await this.updateOrders_(dataOrIdOrSelector, data, sharedContext);
|
196
339
|
const serializedResult = await this.baseRepository_.serialize(result, {
|
197
340
|
populate: true,
|
198
341
|
});
|
199
342
|
return (0, utils_1.isString)(dataOrIdOrSelector) ? serializedResult[0] : serializedResult;
|
200
343
|
}
|
201
|
-
async
|
344
|
+
async updateOrders_(dataOrIdOrSelector, data, sharedContext = {}) {
|
202
345
|
let toUpdate = [];
|
203
346
|
if ((0, utils_1.isString)(dataOrIdOrSelector)) {
|
204
347
|
toUpdate = [
|
@@ -233,7 +376,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
233
376
|
? orderIdOrData
|
234
377
|
: [orderIdOrData];
|
235
378
|
const allOrderIds = data.map((dt) => dt.order_id);
|
236
|
-
const order = await this.
|
379
|
+
const order = await this.listOrders({ id: allOrderIds }, { select: ["id", "version"] }, sharedContext);
|
237
380
|
const mapOrderVersion = order.reduce((acc, curr) => {
|
238
381
|
acc[curr.id] = curr.version;
|
239
382
|
return acc;
|
@@ -251,7 +394,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
251
394
|
});
|
252
395
|
}
|
253
396
|
async createLineItems_(orderId, items, sharedContext = {}) {
|
254
|
-
const order = await this.
|
397
|
+
const order = await this.retrieveOrder(orderId, { select: ["id", "version"] }, sharedContext);
|
255
398
|
const toUpdate = items.map((item) => {
|
256
399
|
return {
|
257
400
|
...item,
|
@@ -403,7 +546,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
403
546
|
? orderIdOrData
|
404
547
|
: [orderIdOrData];
|
405
548
|
const allOrderIds = data.map((dt) => dt.order_id);
|
406
|
-
const order = await this.
|
549
|
+
const order = await this.listOrders({ id: allOrderIds }, { select: ["id", "version"] }, sharedContext);
|
407
550
|
const mapOrderVersion = order.reduce((acc, curr) => {
|
408
551
|
acc[curr.id] = curr.version;
|
409
552
|
return acc;
|
@@ -420,7 +563,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
420
563
|
return await this.baseRepository_.serialize(methods, { populate: true });
|
421
564
|
}
|
422
565
|
async createShippingMethods_(orderId, data, sharedContext = {}) {
|
423
|
-
const order = await this.
|
566
|
+
const order = await this.retrieveOrder(orderId, { select: ["id", "version"] }, sharedContext);
|
424
567
|
const methods = data.map((method) => {
|
425
568
|
return {
|
426
569
|
shipping_method: method,
|
@@ -437,7 +580,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
437
580
|
async createLineItemAdjustments(orderIdOrData, adjustments, sharedContext = {}) {
|
438
581
|
let addedAdjustments = [];
|
439
582
|
if ((0, utils_1.isString)(orderIdOrData)) {
|
440
|
-
const order = await this.
|
583
|
+
const order = await this.retrieveOrder(orderIdOrData, { select: ["id"], relations: ["items.item"] }, sharedContext);
|
441
584
|
const lineIds = order.items?.map((item) => item.id);
|
442
585
|
for (const adj of adjustments || []) {
|
443
586
|
if (!lineIds?.includes(adj.item_id)) {
|
@@ -457,7 +600,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
457
600
|
});
|
458
601
|
}
|
459
602
|
async setLineItemAdjustments(orderId, adjustments, sharedContext = {}) {
|
460
|
-
const order = await this.
|
603
|
+
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["items.item.adjustments"] }, sharedContext);
|
461
604
|
const existingAdjustments = (order.items ?? [])
|
462
605
|
.map((item) => item.adjustments ?? [])
|
463
606
|
.flat()
|
@@ -481,7 +624,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
481
624
|
});
|
482
625
|
}
|
483
626
|
async setShippingMethodAdjustments(orderId, adjustments, sharedContext = {}) {
|
484
|
-
const order = await this.
|
627
|
+
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["shipping_methods.adjustments"] }, sharedContext);
|
485
628
|
const existingAdjustments = (order.shipping_methods ?? [])
|
486
629
|
.map((shippingMethod) => shippingMethod.adjustments ?? [])
|
487
630
|
.flat()
|
@@ -507,7 +650,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
507
650
|
async createShippingMethodAdjustments(orderIdOrData, adjustments, sharedContext = {}) {
|
508
651
|
let addedAdjustments = [];
|
509
652
|
if ((0, utils_1.isString)(orderIdOrData)) {
|
510
|
-
const order = await this.
|
653
|
+
const order = await this.retrieveOrder(orderIdOrData, { select: ["id"], relations: ["shipping_methods"] }, sharedContext);
|
511
654
|
const methodIds = order.shipping_methods?.map((method) => method.id);
|
512
655
|
for (const adj of adjustments || []) {
|
513
656
|
if (!methodIds?.includes(adj.shipping_method_id)) {
|
@@ -552,7 +695,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
552
695
|
return serialized;
|
553
696
|
}
|
554
697
|
async setLineItemTaxLines(orderId, taxLines, sharedContext = {}) {
|
555
|
-
const order = await this.
|
698
|
+
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["items.item.tax_lines"] }, sharedContext);
|
556
699
|
const existingTaxLines = (order.items ?? [])
|
557
700
|
.map((item) => item.tax_lines ?? [])
|
558
701
|
.flat()
|
@@ -592,7 +735,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
592
735
|
return serialized;
|
593
736
|
}
|
594
737
|
async setShippingMethodTaxLines(orderId, taxLines, sharedContext = {}) {
|
595
|
-
const order = await this.
|
738
|
+
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["shipping_methods.tax_lines"] }, sharedContext);
|
596
739
|
const existingTaxLines = (order.shipping_methods ?? [])
|
597
740
|
.map((shippingMethod) => shippingMethod.tax_lines ?? [])
|
598
741
|
.flat()
|
@@ -628,7 +771,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
628
771
|
orderIds.push(change.order_id);
|
629
772
|
dataMap[change.order_id] = change;
|
630
773
|
}
|
631
|
-
const orders = await this.
|
774
|
+
const orders = await this.listOrders({
|
632
775
|
id: orderIds,
|
633
776
|
}, {
|
634
777
|
select: ["id", "version"],
|
@@ -658,7 +801,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
658
801
|
return {
|
659
802
|
...((0, utils_1.isString)(dt) ? { id: dt } : dt),
|
660
803
|
canceled_at: new Date(),
|
661
|
-
status:
|
804
|
+
status: _types_1.OrderChangeStatus.CANCELED,
|
662
805
|
};
|
663
806
|
});
|
664
807
|
await this.orderChangeService_.update(updates, sharedContext);
|
@@ -675,7 +818,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
675
818
|
return {
|
676
819
|
...((0, utils_1.isString)(dt) ? { id: dt } : dt),
|
677
820
|
confirmed_at: new Date(),
|
678
|
-
status:
|
821
|
+
status: _types_1.OrderChangeStatus.CONFIRMED,
|
679
822
|
};
|
680
823
|
});
|
681
824
|
await this.orderChangeService_.update(updates, sharedContext);
|
@@ -685,11 +828,14 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
685
828
|
...action,
|
686
829
|
version: change.version,
|
687
830
|
order_id: change.order_id,
|
831
|
+
return_id: change.return_id,
|
832
|
+
claim_id: change.claim_id,
|
833
|
+
exchange_id: change.exchange_id,
|
688
834
|
};
|
689
835
|
});
|
690
836
|
return change.actions;
|
691
837
|
});
|
692
|
-
await this.applyOrderChanges_(orderChanges.flat(), sharedContext);
|
838
|
+
return await this.applyOrderChanges_(orderChanges.flat(), sharedContext);
|
693
839
|
}
|
694
840
|
async declineOrderChange(orderChangeIdOrData, sharedContext) {
|
695
841
|
const data = Array.isArray(orderChangeIdOrData)
|
@@ -703,14 +849,14 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
703
849
|
return {
|
704
850
|
...((0, utils_1.isString)(dt) ? { id: dt } : dt),
|
705
851
|
declined_at: new Date(),
|
706
|
-
status:
|
852
|
+
status: _types_1.OrderChangeStatus.DECLINED,
|
707
853
|
};
|
708
854
|
});
|
709
855
|
await this.orderChangeService_.update(updates, sharedContext);
|
710
856
|
}
|
711
857
|
async applyPendingOrderActions(orderId, sharedContext) {
|
712
858
|
const orderIds = Array.isArray(orderId) ? orderId : [orderId];
|
713
|
-
const orders = await this.
|
859
|
+
const orders = await this.listOrders({ id: orderIds }, {
|
714
860
|
select: ["id", "version"],
|
715
861
|
}, sharedContext);
|
716
862
|
const changes = await this.orderChangeActionService_.list({
|
@@ -736,10 +882,10 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
736
882
|
ordering: "ASC",
|
737
883
|
},
|
738
884
|
}, sharedContext);
|
739
|
-
await this.applyOrderChanges_(changes, sharedContext);
|
885
|
+
return await this.applyOrderChanges_(changes, sharedContext);
|
740
886
|
}
|
741
887
|
async revertLastVersion(orderId, sharedContext) {
|
742
|
-
const order = await super.
|
888
|
+
const order = await super.retrieveOrder(orderId, {
|
743
889
|
select: ["id", "version"],
|
744
890
|
}, sharedContext);
|
745
891
|
if (order.version < 2) {
|
@@ -793,6 +939,11 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
793
939
|
version: order.version - 1,
|
794
940
|
},
|
795
941
|
}, sharedContext);
|
942
|
+
// Returns
|
943
|
+
await this.returnService_.delete({
|
944
|
+
order_id: order.id,
|
945
|
+
order_version: currentVersion,
|
946
|
+
}, sharedContext);
|
796
947
|
}
|
797
948
|
async getAndValidateOrderChange_(orderChangeIds, includeActions, sharedContext) {
|
798
949
|
const options = {
|
@@ -819,8 +970,8 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
819
970
|
}
|
820
971
|
for (const orderChange of orderChanges) {
|
821
972
|
const notAllowed = [];
|
822
|
-
if (!(orderChange.status ===
|
823
|
-
orderChange.status ===
|
973
|
+
if (!(orderChange.status === _types_1.OrderChangeStatus.PENDING ||
|
974
|
+
orderChange.status === _types_1.OrderChangeStatus.REQUESTED)) {
|
824
975
|
notAllowed.push(orderChange.id);
|
825
976
|
}
|
826
977
|
if (notAllowed.length) {
|
@@ -876,74 +1027,32 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
876
1027
|
});
|
877
1028
|
}
|
878
1029
|
if (!ordersIds.length) {
|
879
|
-
return
|
1030
|
+
return {
|
1031
|
+
items: [],
|
1032
|
+
shippingMethods: [],
|
1033
|
+
};
|
880
1034
|
}
|
881
|
-
|
1035
|
+
let orders = await super.listOrders({ id: (0, utils_1.deduplicate)(ordersIds) }, {
|
882
1036
|
select: [
|
883
1037
|
"id",
|
884
1038
|
"version",
|
885
1039
|
"items.detail",
|
886
1040
|
"transactions",
|
1041
|
+
"shipping_methods",
|
887
1042
|
"summary",
|
888
1043
|
"total",
|
889
1044
|
],
|
890
|
-
relations: [
|
1045
|
+
relations: [
|
1046
|
+
"transactions",
|
1047
|
+
"items",
|
1048
|
+
"items.detail",
|
1049
|
+
"shipping_methods",
|
1050
|
+
],
|
891
1051
|
}, sharedContext);
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
const orderToUpdate =
|
896
|
-
for (const order of orders) {
|
897
|
-
const calculated = (0, utils_2.calculateOrderChange)({
|
898
|
-
order: order,
|
899
|
-
actions: actionsMap[order.id],
|
900
|
-
transactions: order.transactions,
|
901
|
-
});
|
902
|
-
(0, utils_1.createRawPropertiesFromBigNumber)(calculated);
|
903
|
-
const version = actionsMap[order.id][0].version;
|
904
|
-
for (const item of calculated.order.items) {
|
905
|
-
const orderItem = item.detail;
|
906
|
-
itemsToUpsert.push({
|
907
|
-
id: orderItem.version === version ? orderItem.id : undefined,
|
908
|
-
item_id: item.id,
|
909
|
-
order_id: order.id,
|
910
|
-
version,
|
911
|
-
quantity: item.detail.quantity,
|
912
|
-
fulfilled_quantity: item.detail.fulfilled_quantity,
|
913
|
-
shipped_quantity: item.detail.shipped_quantity,
|
914
|
-
return_requested_quantity: item.detail.return_requested_quantity,
|
915
|
-
return_received_quantity: item.detail.return_received_quantity,
|
916
|
-
return_dismissed_quantity: item.detail.return_dismissed_quantity,
|
917
|
-
written_off_quantity: item.detail.written_off_quantity,
|
918
|
-
metadata: item.detail.metadata,
|
919
|
-
});
|
920
|
-
}
|
921
|
-
const orderSummary = order.summary;
|
922
|
-
summariesToUpsert.push({
|
923
|
-
id: orderSummary.version === version ? orderSummary.id : undefined,
|
924
|
-
order_id: order.id,
|
925
|
-
version,
|
926
|
-
totals: calculated.summary,
|
927
|
-
});
|
928
|
-
if (version > order.version) {
|
929
|
-
for (const shippingMethod of order.shipping_methods ?? []) {
|
930
|
-
const sm = {
|
931
|
-
...shippingMethod.detail,
|
932
|
-
version,
|
933
|
-
};
|
934
|
-
delete sm.id;
|
935
|
-
shippingMethodsToInsert.push(sm);
|
936
|
-
}
|
937
|
-
orderToUpdate.push({
|
938
|
-
selector: {
|
939
|
-
id: order.id,
|
940
|
-
},
|
941
|
-
data: {
|
942
|
-
version,
|
943
|
-
},
|
944
|
-
});
|
945
|
-
}
|
946
|
-
}
|
1052
|
+
orders = (0, utils_2.formatOrder)(orders, {
|
1053
|
+
entity: _models_1.Order,
|
1054
|
+
});
|
1055
|
+
const { itemsToUpsert, shippingMethodsToInsert, summariesToUpsert, orderToUpdate, } = (0, utils_2.applyChangesToOrder)(orders, actionsMap);
|
947
1056
|
await (0, utils_1.promiseAll)([
|
948
1057
|
orderToUpdate.length
|
949
1058
|
? this.orderService_.update(orderToUpdate, sharedContext)
|
@@ -961,106 +1070,10 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
961
1070
|
? this.orderShippingMethodService_.create(shippingMethodsToInsert, sharedContext)
|
962
1071
|
: null,
|
963
1072
|
]);
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
action: utils_2.ChangeActionType.FULFILL_ITEM,
|
969
|
-
internal_note: item.internal_note,
|
970
|
-
reference: data.reference,
|
971
|
-
reference_id: data.reference_id,
|
972
|
-
details: {
|
973
|
-
reference_id: item.id,
|
974
|
-
quantity: item.quantity,
|
975
|
-
metadata: item.metadata,
|
976
|
-
},
|
977
|
-
};
|
978
|
-
});
|
979
|
-
const change = await this.createOrderChange_({
|
980
|
-
order_id: data.order_id,
|
981
|
-
description: data.description,
|
982
|
-
internal_note: data.internal_note,
|
983
|
-
created_by: data.created_by,
|
984
|
-
metadata: data.metadata,
|
985
|
-
actions: items,
|
986
|
-
}, sharedContext);
|
987
|
-
await this.confirmOrderChange(change[0].id, sharedContext);
|
988
|
-
}
|
989
|
-
async registerShipment(data, sharedContext) {
|
990
|
-
let shippingMethodId;
|
991
|
-
const actions = data.items.map((item) => {
|
992
|
-
return {
|
993
|
-
action: utils_2.ChangeActionType.SHIP_ITEM,
|
994
|
-
internal_note: item.internal_note,
|
995
|
-
reference: data.reference,
|
996
|
-
reference_id: data.reference_id,
|
997
|
-
details: {
|
998
|
-
reference_id: item.id,
|
999
|
-
quantity: item.quantity,
|
1000
|
-
metadata: item.metadata,
|
1001
|
-
},
|
1002
|
-
};
|
1003
|
-
});
|
1004
|
-
if (shippingMethodId) {
|
1005
|
-
actions.push({
|
1006
|
-
action: utils_2.ChangeActionType.SHIPPING_ADD,
|
1007
|
-
reference: data.reference,
|
1008
|
-
reference_id: shippingMethodId,
|
1009
|
-
});
|
1010
|
-
}
|
1011
|
-
const change = await this.createOrderChange_({
|
1012
|
-
order_id: data.order_id,
|
1013
|
-
description: data.description,
|
1014
|
-
internal_note: data.internal_note,
|
1015
|
-
created_by: data.created_by,
|
1016
|
-
metadata: data.metadata,
|
1017
|
-
actions,
|
1018
|
-
}, sharedContext);
|
1019
|
-
await this.confirmOrderChange(change[0].id, sharedContext);
|
1020
|
-
}
|
1021
|
-
async createReturn(data, sharedContext) {
|
1022
|
-
let shippingMethodId;
|
1023
|
-
if (!(0, utils_1.isString)(data.shipping_method)) {
|
1024
|
-
const methods = await this.createShippingMethods(data.order_id, [{ order_id: data.order_id, ...data.shipping_method }], sharedContext);
|
1025
|
-
shippingMethodId = methods[0].id;
|
1026
|
-
}
|
1027
|
-
else {
|
1028
|
-
shippingMethodId = data.shipping_method;
|
1029
|
-
}
|
1030
|
-
const method = await this.shippingMethodService_.retrieve(shippingMethodId, {
|
1031
|
-
relations: ["tax_lines", "adjustments"],
|
1032
|
-
}, sharedContext);
|
1033
|
-
const calculatedAmount = (0, utils_1.getShippingMethodsTotals)([method], {})[method.id];
|
1034
|
-
const actions = data.items.map((item) => {
|
1035
|
-
return {
|
1036
|
-
action: utils_2.ChangeActionType.RETURN_ITEM,
|
1037
|
-
internal_note: item.internal_note,
|
1038
|
-
reference: data.reference ?? "fulfillment",
|
1039
|
-
reference_id: data.reference_id ?? shippingMethodId,
|
1040
|
-
details: {
|
1041
|
-
reference_id: item.id,
|
1042
|
-
quantity: item.quantity,
|
1043
|
-
metadata: item.metadata,
|
1044
|
-
},
|
1045
|
-
};
|
1046
|
-
});
|
1047
|
-
if (shippingMethodId) {
|
1048
|
-
actions.push({
|
1049
|
-
action: utils_2.ChangeActionType.SHIPPING_ADD,
|
1050
|
-
reference: data.reference ?? "fulfillment",
|
1051
|
-
reference_id: data.reference_id ?? shippingMethodId,
|
1052
|
-
amount: calculatedAmount.total,
|
1053
|
-
});
|
1054
|
-
}
|
1055
|
-
const change = await this.createOrderChange_({
|
1056
|
-
order_id: data.order_id,
|
1057
|
-
description: data.description,
|
1058
|
-
internal_note: data.internal_note,
|
1059
|
-
created_by: data.created_by,
|
1060
|
-
metadata: data.metadata,
|
1061
|
-
actions,
|
1062
|
-
}, sharedContext);
|
1063
|
-
await this.confirmOrderChange(change[0].id, sharedContext);
|
1073
|
+
return {
|
1074
|
+
items: itemsToUpsert,
|
1075
|
+
shippingMethods: shippingMethodsToInsert,
|
1076
|
+
};
|
1064
1077
|
}
|
1065
1078
|
async addTransactions(transactionData, sharedContext) {
|
1066
1079
|
const orders = await this.orderService_.list({
|
@@ -1192,33 +1205,9 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
1192
1205
|
}
|
1193
1206
|
return await this.returnReasonService_.update(toUpdate, sharedContext);
|
1194
1207
|
}
|
1195
|
-
async receiveReturn(data, sharedContext) {
|
1196
|
-
const items = data.items.map((item) => {
|
1197
|
-
return {
|
1198
|
-
action: utils_2.ChangeActionType.RECEIVE_RETURN_ITEM,
|
1199
|
-
internal_note: item.internal_note,
|
1200
|
-
reference: data.reference,
|
1201
|
-
reference_id: data.reference_id,
|
1202
|
-
details: {
|
1203
|
-
reference_id: item.id,
|
1204
|
-
quantity: item.quantity,
|
1205
|
-
metadata: item.metadata,
|
1206
|
-
},
|
1207
|
-
};
|
1208
|
-
});
|
1209
|
-
const change = await this.createOrderChange_({
|
1210
|
-
order_id: data.order_id,
|
1211
|
-
description: data.description,
|
1212
|
-
internal_note: data.internal_note,
|
1213
|
-
created_by: data.created_by,
|
1214
|
-
metadata: data.metadata,
|
1215
|
-
actions: items,
|
1216
|
-
}, sharedContext);
|
1217
|
-
await this.confirmOrderChange(change[0].id, sharedContext);
|
1218
|
-
}
|
1219
1208
|
async archive(orderId, sharedContext) {
|
1220
1209
|
const orderIds = Array.isArray(orderId) ? orderId : [orderId];
|
1221
|
-
const orders = await this.
|
1210
|
+
const orders = await this.listOrders({
|
1222
1211
|
id: orderIds,
|
1223
1212
|
}, {}, sharedContext);
|
1224
1213
|
const notAllowed = [];
|
@@ -1243,7 +1232,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
1243
1232
|
}
|
1244
1233
|
async completeOrder(orderId, sharedContext) {
|
1245
1234
|
const orderIds = Array.isArray(orderId) ? orderId : [orderId];
|
1246
|
-
const orders = await this.
|
1235
|
+
const orders = await this.listOrders({
|
1247
1236
|
id: orderIds,
|
1248
1237
|
}, {}, sharedContext);
|
1249
1238
|
const notAllowed = [];
|
@@ -1256,42 +1245,205 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.abstractModuleServiceFa
|
|
1256
1245
|
if (notAllowed.length) {
|
1257
1246
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Orders ${notAllowed.join(", ")} are canceled and cannot be completed`);
|
1258
1247
|
}
|
1259
|
-
await this.orderService_.update({
|
1248
|
+
await this.orderService_.update(orderIds.map((id) => {
|
1249
|
+
return {
|
1250
|
+
id,
|
1251
|
+
status: utils_1.OrderStatus.COMPLETED,
|
1252
|
+
};
|
1253
|
+
}), sharedContext);
|
1254
|
+
return Array.isArray(orderId) ? orders : orders[0];
|
1255
|
+
}
|
1256
|
+
async cancel(orderId, sharedContext) {
|
1257
|
+
const orderIds = Array.isArray(orderId) ? orderId : [orderId];
|
1258
|
+
const orders = await this.listOrders({
|
1260
1259
|
id: orderIds,
|
1261
|
-
|
1262
|
-
|
1260
|
+
}, {}, sharedContext);
|
1261
|
+
const canceled_at = new Date();
|
1262
|
+
for (const order of orders) {
|
1263
|
+
order.status = utils_1.OrderStatus.CANCELED;
|
1264
|
+
order.canceled_at = canceled_at;
|
1265
|
+
}
|
1266
|
+
await this.orderService_.update(orderIds.map((id) => {
|
1267
|
+
return {
|
1268
|
+
id,
|
1269
|
+
status: utils_1.OrderStatus.CANCELED,
|
1270
|
+
canceled_at,
|
1271
|
+
};
|
1272
|
+
}), sharedContext);
|
1263
1273
|
return Array.isArray(orderId) ? orders : orders[0];
|
1264
1274
|
}
|
1275
|
+
// ------------------- Bundled Order Actions
|
1276
|
+
async createReturn(data, sharedContext) {
|
1277
|
+
// TODO: type ReturnDTO
|
1278
|
+
const ret = await BundledActions.createReturn.bind(this)(data, sharedContext);
|
1279
|
+
return await this.retrieveReturn(ret.id, {
|
1280
|
+
relations: ["items"],
|
1281
|
+
}, sharedContext);
|
1282
|
+
}
|
1283
|
+
async receiveReturn(data, sharedContext) {
|
1284
|
+
const ret = await this.receiveReturn_(data, sharedContext);
|
1285
|
+
return await this.retrieveReturn(ret.id, {
|
1286
|
+
relations: ["items"],
|
1287
|
+
});
|
1288
|
+
}
|
1289
|
+
async receiveReturn_(data, sharedContext) {
|
1290
|
+
return await BundledActions.receiveReturn.bind(this)(data, sharedContext);
|
1291
|
+
}
|
1292
|
+
async createClaim(data, sharedContext) {
|
1293
|
+
const ret = await this.createClaim_(data, sharedContext);
|
1294
|
+
const claim = await this.retrieveOrderClaim(ret.id, {
|
1295
|
+
relations: [
|
1296
|
+
"additional_items",
|
1297
|
+
"additional_items.item",
|
1298
|
+
"claim_items",
|
1299
|
+
"claim_items.item",
|
1300
|
+
"return",
|
1301
|
+
"return.items",
|
1302
|
+
"shipping_methods",
|
1303
|
+
"shipping_methods.tax_lines",
|
1304
|
+
"shipping_methods.adjustments",
|
1305
|
+
"transactions",
|
1306
|
+
],
|
1307
|
+
}, sharedContext);
|
1308
|
+
return await this.baseRepository_.serialize(claim, {
|
1309
|
+
populate: true,
|
1310
|
+
});
|
1311
|
+
}
|
1312
|
+
async createExchange_(data, sharedContext) {
|
1313
|
+
return await BundledActions.createExchange.bind(this)(data, sharedContext);
|
1314
|
+
}
|
1315
|
+
async createExchange(data, sharedContext) {
|
1316
|
+
const ret = await this.createExchange_(data, sharedContext);
|
1317
|
+
const claim = await this.retrieveOrderExchange(ret.id, {
|
1318
|
+
relations: [
|
1319
|
+
"additional_items",
|
1320
|
+
"additional_items.item",
|
1321
|
+
"return",
|
1322
|
+
"return.items",
|
1323
|
+
"shipping_methods",
|
1324
|
+
"shipping_methods.tax_lines",
|
1325
|
+
"shipping_methods.adjustments",
|
1326
|
+
"transactions",
|
1327
|
+
],
|
1328
|
+
}, sharedContext);
|
1329
|
+
return await this.baseRepository_.serialize(claim, {
|
1330
|
+
populate: true,
|
1331
|
+
});
|
1332
|
+
}
|
1333
|
+
async createClaim_(data, sharedContext) {
|
1334
|
+
return await BundledActions.createClaim.bind(this)(data, sharedContext);
|
1335
|
+
}
|
1336
|
+
async registerFulfillment(data, sharedContext) {
|
1337
|
+
return await BundledActions.registerFulfillment.bind(this)(data, sharedContext);
|
1338
|
+
}
|
1339
|
+
async cancelFulfillment(data, sharedContext) {
|
1340
|
+
return await BundledActions.cancelFulfillment.bind(this)(data, sharedContext);
|
1341
|
+
}
|
1342
|
+
async registerShipment(data, sharedContext) {
|
1343
|
+
return await BundledActions.registerShipment.bind(this)(data, sharedContext);
|
1344
|
+
}
|
1265
1345
|
}
|
1266
1346
|
exports.default = OrderModuleService;
|
1347
|
+
__decorate([
|
1348
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1349
|
+
__metadata("design:type", Function),
|
1350
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
1351
|
+
__metadata("design:returntype", Promise)
|
1352
|
+
], OrderModuleService.prototype, "retrieveOrder", null);
|
1353
|
+
__decorate([
|
1354
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1355
|
+
__metadata("design:type", Function),
|
1356
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1357
|
+
__metadata("design:returntype", Promise)
|
1358
|
+
], OrderModuleService.prototype, "listOrders", null);
|
1359
|
+
__decorate([
|
1360
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1361
|
+
__metadata("design:type", Function),
|
1362
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1363
|
+
__metadata("design:returntype", Promise)
|
1364
|
+
], OrderModuleService.prototype, "listAndCountOrders", null);
|
1365
|
+
__decorate([
|
1366
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1367
|
+
__metadata("design:type", Function),
|
1368
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
1369
|
+
__metadata("design:returntype", Promise)
|
1370
|
+
], OrderModuleService.prototype, "retrieveReturn", null);
|
1371
|
+
__decorate([
|
1372
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1373
|
+
__metadata("design:type", Function),
|
1374
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1375
|
+
__metadata("design:returntype", Promise)
|
1376
|
+
], OrderModuleService.prototype, "listReturns", null);
|
1377
|
+
__decorate([
|
1378
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1379
|
+
__metadata("design:type", Function),
|
1380
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1381
|
+
__metadata("design:returntype", Promise)
|
1382
|
+
], OrderModuleService.prototype, "listAndCountReturns", null);
|
1383
|
+
__decorate([
|
1384
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1385
|
+
__metadata("design:type", Function),
|
1386
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
1387
|
+
__metadata("design:returntype", Promise)
|
1388
|
+
], OrderModuleService.prototype, "retrieveOrderClaim", null);
|
1389
|
+
__decorate([
|
1390
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1391
|
+
__metadata("design:type", Function),
|
1392
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1393
|
+
__metadata("design:returntype", Promise)
|
1394
|
+
], OrderModuleService.prototype, "listOrderClaims", null);
|
1395
|
+
__decorate([
|
1396
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1397
|
+
__metadata("design:type", Function),
|
1398
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1399
|
+
__metadata("design:returntype", Promise)
|
1400
|
+
], OrderModuleService.prototype, "listAndCountOrderClaims", null);
|
1401
|
+
__decorate([
|
1402
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1403
|
+
__metadata("design:type", Function),
|
1404
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
1405
|
+
__metadata("design:returntype", Promise)
|
1406
|
+
], OrderModuleService.prototype, "retrieveOrderExchange", null);
|
1407
|
+
__decorate([
|
1408
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1409
|
+
__metadata("design:type", Function),
|
1410
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1411
|
+
__metadata("design:returntype", Promise)
|
1412
|
+
], OrderModuleService.prototype, "listOrderExchanges", null);
|
1413
|
+
__decorate([
|
1414
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1415
|
+
__metadata("design:type", Function),
|
1416
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
1417
|
+
__metadata("design:returntype", Promise)
|
1418
|
+
], OrderModuleService.prototype, "listAndCountOrderExchanges", null);
|
1267
1419
|
__decorate([
|
1268
1420
|
(0, utils_1.InjectManager)("baseRepository_"),
|
1269
1421
|
__param(1, (0, utils_1.MedusaContext)()),
|
1270
1422
|
__metadata("design:type", Function),
|
1271
1423
|
__metadata("design:paramtypes", [Object, Object]),
|
1272
1424
|
__metadata("design:returntype", Promise)
|
1273
|
-
], OrderModuleService.prototype, "
|
1425
|
+
], OrderModuleService.prototype, "createOrders", null);
|
1274
1426
|
__decorate([
|
1275
1427
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1276
1428
|
__param(1, (0, utils_1.MedusaContext)()),
|
1277
1429
|
__metadata("design:type", Function),
|
1278
1430
|
__metadata("design:paramtypes", [Array, Object]),
|
1279
1431
|
__metadata("design:returntype", Promise)
|
1280
|
-
], OrderModuleService.prototype, "
|
1432
|
+
], OrderModuleService.prototype, "createOrders_", null);
|
1281
1433
|
__decorate([
|
1282
1434
|
(0, utils_1.InjectManager)("baseRepository_"),
|
1283
1435
|
__param(2, (0, utils_1.MedusaContext)()),
|
1284
1436
|
__metadata("design:type", Function),
|
1285
1437
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
1286
1438
|
__metadata("design:returntype", Promise)
|
1287
|
-
], OrderModuleService.prototype, "
|
1439
|
+
], OrderModuleService.prototype, "updateOrders", null);
|
1288
1440
|
__decorate([
|
1289
1441
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1290
1442
|
__param(2, (0, utils_1.MedusaContext)()),
|
1291
1443
|
__metadata("design:type", Function),
|
1292
1444
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
1293
1445
|
__metadata("design:returntype", Promise)
|
1294
|
-
], OrderModuleService.prototype, "
|
1446
|
+
], OrderModuleService.prototype, "updateOrders_", null);
|
1295
1447
|
__decorate([
|
1296
1448
|
(0, utils_1.InjectManager)("baseRepository_"),
|
1297
1449
|
__param(2, (0, utils_1.MedusaContext)()),
|
@@ -1462,42 +1614,49 @@ __decorate([
|
|
1462
1614
|
], OrderModuleService.prototype, "setShippingMethodTaxLines", null);
|
1463
1615
|
__decorate([
|
1464
1616
|
(0, utils_1.InjectManager)("baseRepository_"),
|
1617
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1465
1618
|
__metadata("design:type", Function),
|
1466
1619
|
__metadata("design:paramtypes", [Object, Object]),
|
1467
1620
|
__metadata("design:returntype", Promise)
|
1468
1621
|
], OrderModuleService.prototype, "createOrderChange", null);
|
1469
1622
|
__decorate([
|
1470
1623
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1624
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1471
1625
|
__metadata("design:type", Function),
|
1472
1626
|
__metadata("design:paramtypes", [Object, Object]),
|
1473
1627
|
__metadata("design:returntype", Promise)
|
1474
1628
|
], OrderModuleService.prototype, "createOrderChange_", null);
|
1475
1629
|
__decorate([
|
1476
1630
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1631
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1477
1632
|
__metadata("design:type", Function),
|
1478
1633
|
__metadata("design:paramtypes", [Object, Object]),
|
1479
1634
|
__metadata("design:returntype", Promise)
|
1480
1635
|
], OrderModuleService.prototype, "cancelOrderChange", null);
|
1481
1636
|
__decorate([
|
1482
1637
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1638
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1483
1639
|
__metadata("design:type", Function),
|
1484
1640
|
__metadata("design:paramtypes", [Object, Object]),
|
1485
1641
|
__metadata("design:returntype", Promise)
|
1486
1642
|
], OrderModuleService.prototype, "confirmOrderChange", null);
|
1487
1643
|
__decorate([
|
1488
1644
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1645
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1489
1646
|
__metadata("design:type", Function),
|
1490
1647
|
__metadata("design:paramtypes", [Object, Object]),
|
1491
1648
|
__metadata("design:returntype", Promise)
|
1492
1649
|
], OrderModuleService.prototype, "declineOrderChange", null);
|
1493
1650
|
__decorate([
|
1494
1651
|
(0, utils_1.InjectManager)("baseRepository_"),
|
1652
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1495
1653
|
__metadata("design:type", Function),
|
1496
1654
|
__metadata("design:paramtypes", [Object, Object]),
|
1497
1655
|
__metadata("design:returntype", Promise)
|
1498
1656
|
], OrderModuleService.prototype, "applyPendingOrderActions", null);
|
1499
1657
|
__decorate([
|
1500
1658
|
(0, utils_1.InjectManager)("baseRepository_"),
|
1659
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1501
1660
|
__metadata("design:type", Function),
|
1502
1661
|
__metadata("design:paramtypes", [String, Object]),
|
1503
1662
|
__metadata("design:returntype", Promise)
|
@@ -1510,30 +1669,14 @@ __decorate([
|
|
1510
1669
|
], OrderModuleService.prototype, "revertLastChange_", null);
|
1511
1670
|
__decorate([
|
1512
1671
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1672
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1513
1673
|
__metadata("design:type", Function),
|
1514
1674
|
__metadata("design:paramtypes", [Object, Object]),
|
1515
1675
|
__metadata("design:returntype", Promise)
|
1516
1676
|
], OrderModuleService.prototype, "addOrderAction", null);
|
1517
|
-
__decorate([
|
1518
|
-
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1519
|
-
__metadata("design:type", Function),
|
1520
|
-
__metadata("design:paramtypes", [Object, Object]),
|
1521
|
-
__metadata("design:returntype", Promise)
|
1522
|
-
], OrderModuleService.prototype, "registerFulfillment", null);
|
1523
|
-
__decorate([
|
1524
|
-
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1525
|
-
__metadata("design:type", Function),
|
1526
|
-
__metadata("design:paramtypes", [Object, Object]),
|
1527
|
-
__metadata("design:returntype", Promise)
|
1528
|
-
], OrderModuleService.prototype, "registerShipment", null);
|
1529
|
-
__decorate([
|
1530
|
-
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1531
|
-
__metadata("design:type", Function),
|
1532
|
-
__metadata("design:paramtypes", [Object, Object]),
|
1533
|
-
__metadata("design:returntype", Promise)
|
1534
|
-
], OrderModuleService.prototype, "createReturn", null);
|
1535
1677
|
__decorate([
|
1536
1678
|
(0, utils_1.InjectManager)("baseRepository_"),
|
1679
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1537
1680
|
__metadata("design:type", Function),
|
1538
1681
|
__metadata("design:paramtypes", [Object, Object]),
|
1539
1682
|
__metadata("design:returntype", Promise)
|
@@ -1542,6 +1685,7 @@ __decorate([
|
|
1542
1685
|
(0, utils_1.InjectManager)("baseRepository_")
|
1543
1686
|
// @ts-ignore
|
1544
1687
|
,
|
1688
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1545
1689
|
__metadata("design:type", Function),
|
1546
1690
|
__metadata("design:paramtypes", [Object, Object]),
|
1547
1691
|
__metadata("design:returntype", Promise)
|
@@ -1550,6 +1694,7 @@ __decorate([
|
|
1550
1694
|
(0, utils_1.InjectManager)("baseRepository_")
|
1551
1695
|
// @ts-ignore
|
1552
1696
|
,
|
1697
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1553
1698
|
__metadata("design:type", Function),
|
1554
1699
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
1555
1700
|
__metadata("design:returntype", Promise)
|
@@ -1558,6 +1703,7 @@ __decorate([
|
|
1558
1703
|
(0, utils_1.InjectManager)("baseRepository_")
|
1559
1704
|
// @ts-ignore
|
1560
1705
|
,
|
1706
|
+
__param(2, (0, utils_1.MedusaContext)()),
|
1561
1707
|
__metadata("design:type", Function),
|
1562
1708
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
1563
1709
|
__metadata("design:returntype", Promise)
|
@@ -1570,6 +1716,7 @@ __decorate([
|
|
1570
1716
|
], OrderModuleService.prototype, "updateOrderPaidRefundableAmount_", null);
|
1571
1717
|
__decorate([
|
1572
1718
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1719
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1573
1720
|
__metadata("design:type", Function),
|
1574
1721
|
__metadata("design:paramtypes", [Object, Object]),
|
1575
1722
|
__metadata("design:returntype", Promise)
|
@@ -1597,20 +1744,93 @@ __decorate([
|
|
1597
1744
|
], OrderModuleService.prototype, "updateReturnReasonsWithSelector_", null);
|
1598
1745
|
__decorate([
|
1599
1746
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1747
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1748
|
+
__metadata("design:type", Function),
|
1749
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1750
|
+
__metadata("design:returntype", Promise)
|
1751
|
+
], OrderModuleService.prototype, "archive", null);
|
1752
|
+
__decorate([
|
1753
|
+
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1754
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1755
|
+
__metadata("design:type", Function),
|
1756
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1757
|
+
__metadata("design:returntype", Promise)
|
1758
|
+
], OrderModuleService.prototype, "completeOrder", null);
|
1759
|
+
__decorate([
|
1760
|
+
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1761
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1762
|
+
__metadata("design:type", Function),
|
1763
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1764
|
+
__metadata("design:returntype", Promise)
|
1765
|
+
], OrderModuleService.prototype, "cancel", null);
|
1766
|
+
__decorate([
|
1767
|
+
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1768
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1769
|
+
__metadata("design:type", Function),
|
1770
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1771
|
+
__metadata("design:returntype", Promise)
|
1772
|
+
], OrderModuleService.prototype, "createReturn", null);
|
1773
|
+
__decorate([
|
1774
|
+
(0, utils_1.InjectManager)("baseRepository_"),
|
1775
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1600
1776
|
__metadata("design:type", Function),
|
1601
1777
|
__metadata("design:paramtypes", [Object, Object]),
|
1602
1778
|
__metadata("design:returntype", Promise)
|
1603
1779
|
], OrderModuleService.prototype, "receiveReturn", null);
|
1604
1780
|
__decorate([
|
1605
1781
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1782
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1606
1783
|
__metadata("design:type", Function),
|
1607
1784
|
__metadata("design:paramtypes", [Object, Object]),
|
1608
1785
|
__metadata("design:returntype", Promise)
|
1609
|
-
], OrderModuleService.prototype, "
|
1786
|
+
], OrderModuleService.prototype, "receiveReturn_", null);
|
1787
|
+
__decorate([
|
1788
|
+
(0, utils_1.InjectManager)("baseRepository_"),
|
1789
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1790
|
+
__metadata("design:type", Function),
|
1791
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1792
|
+
__metadata("design:returntype", Promise)
|
1793
|
+
], OrderModuleService.prototype, "createClaim", null);
|
1610
1794
|
__decorate([
|
1611
1795
|
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1796
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1612
1797
|
__metadata("design:type", Function),
|
1613
1798
|
__metadata("design:paramtypes", [Object, Object]),
|
1614
1799
|
__metadata("design:returntype", Promise)
|
1615
|
-
], OrderModuleService.prototype, "
|
1800
|
+
], OrderModuleService.prototype, "createExchange_", null);
|
1801
|
+
__decorate([
|
1802
|
+
(0, utils_1.InjectManager)("baseRepository_"),
|
1803
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1804
|
+
__metadata("design:type", Function),
|
1805
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1806
|
+
__metadata("design:returntype", Promise)
|
1807
|
+
], OrderModuleService.prototype, "createExchange", null);
|
1808
|
+
__decorate([
|
1809
|
+
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1810
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1811
|
+
__metadata("design:type", Function),
|
1812
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1813
|
+
__metadata("design:returntype", Promise)
|
1814
|
+
], OrderModuleService.prototype, "createClaim_", null);
|
1815
|
+
__decorate([
|
1816
|
+
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1817
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1818
|
+
__metadata("design:type", Function),
|
1819
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1820
|
+
__metadata("design:returntype", Promise)
|
1821
|
+
], OrderModuleService.prototype, "registerFulfillment", null);
|
1822
|
+
__decorate([
|
1823
|
+
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1824
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1825
|
+
__metadata("design:type", Function),
|
1826
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1827
|
+
__metadata("design:returntype", Promise)
|
1828
|
+
], OrderModuleService.prototype, "cancelFulfillment", null);
|
1829
|
+
__decorate([
|
1830
|
+
(0, utils_1.InjectTransactionManager)("baseRepository_"),
|
1831
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
1832
|
+
__metadata("design:type", Function),
|
1833
|
+
__metadata("design:paramtypes", [Object, Object]),
|
1834
|
+
__metadata("design:returntype", Promise)
|
1835
|
+
], OrderModuleService.prototype, "registerShipment", null);
|
1616
1836
|
//# sourceMappingURL=order-module-service.js.map
|