@medusajs/order 3.0.0-preview-20250211091350 → 3.0.0-preview-20250406164537
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/migrations/Migration20250326151554.d.ts +6 -0
- package/dist/migrations/Migration20250326151554.d.ts.map +1 -0
- package/dist/migrations/Migration20250326151554.js +14 -0
- package/dist/migrations/Migration20250326151554.js.map +1 -0
- package/dist/models/line-item.d.ts.map +1 -1
- package/dist/models/line-item.js +1 -0
- package/dist/models/line-item.js.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +13 -14
- package/dist/schema/index.js.map +1 -1
- package/dist/services/order-module-service.d.ts +9 -2
- package/dist/services/order-module-service.d.ts.map +1 -1
- package/dist/services/order-module-service.js +111 -32
- package/dist/services/order-module-service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/utils/index.d.ts +12 -9
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/index.js.map +1 -1
- package/dist/utils/actions/credit-line-add.js +11 -11
- package/dist/utils/actions/credit-line-add.js.map +1 -1
- package/dist/utils/actions/index.d.ts +3 -0
- package/dist/utils/actions/index.d.ts.map +1 -1
- package/dist/utils/actions/index.js +3 -0
- package/dist/utils/actions/index.js.map +1 -1
- package/dist/utils/actions/promotion-add.d.ts +2 -0
- package/dist/utils/actions/promotion-add.d.ts.map +1 -0
- package/dist/utils/actions/promotion-add.js +15 -0
- package/dist/utils/actions/promotion-add.js.map +1 -0
- package/dist/utils/actions/promotion-remove.d.ts +2 -0
- package/dist/utils/actions/promotion-remove.d.ts.map +1 -0
- package/dist/utils/actions/promotion-remove.js +15 -0
- package/dist/utils/actions/promotion-remove.js.map +1 -0
- package/dist/utils/actions/shipping-update.d.ts +2 -0
- package/dist/utils/actions/shipping-update.d.ts.map +1 -0
- package/dist/utils/actions/shipping-update.js +15 -0
- package/dist/utils/actions/shipping-update.js.map +1 -0
- package/dist/utils/apply-order-changes.d.ts +5 -3
- package/dist/utils/apply-order-changes.d.ts.map +1 -1
- package/dist/utils/apply-order-changes.js +29 -9
- package/dist/utils/apply-order-changes.js.map +1 -1
- package/dist/utils/calculate-order-change.d.ts +4 -2
- package/dist/utils/calculate-order-change.d.ts.map +1 -1
- package/dist/utils/calculate-order-change.js +43 -16
- package/dist/utils/calculate-order-change.js.map +1 -1
- package/package.json +4 -4
@@ -106,7 +106,7 @@ const generateMethodForModels = {
|
|
106
106
|
}
|
107
107
|
// TODO: rm template args here, keep it for later to not collide with carlos work at least as little as possible
|
108
108
|
class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateMethodForModels) {
|
109
|
-
constructor({ baseRepository, orderService, orderAddressService, orderLineItemService, orderShippingMethodAdjustmentService, orderShippingMethodService, orderLineItemAdjustmentService, orderShippingMethodTaxLineService, orderLineItemTaxLineService, orderTransactionService, orderChangeService, orderChangeActionService, orderItemService, orderSummaryService, orderShippingService, returnReasonService, returnService, returnItemService, orderClaimService, orderExchangeService, }, moduleDeclaration) {
|
109
|
+
constructor({ baseRepository, orderService, orderAddressService, orderLineItemService, orderShippingMethodAdjustmentService, orderShippingMethodService, orderLineItemAdjustmentService, orderShippingMethodTaxLineService, orderLineItemTaxLineService, orderTransactionService, orderChangeService, orderChangeActionService, orderItemService, orderSummaryService, orderShippingService, returnReasonService, returnService, returnItemService, orderClaimService, orderExchangeService, orderCreditLineService, }, moduleDeclaration) {
|
110
110
|
// @ts-ignore
|
111
111
|
super(...arguments);
|
112
112
|
this.moduleDeclaration = moduleDeclaration;
|
@@ -131,6 +131,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
131
131
|
this.returnItemService_ = returnItemService;
|
132
132
|
this.orderClaimService_ = orderClaimService;
|
133
133
|
this.orderExchangeService_ = orderExchangeService;
|
134
|
+
this.orderCreditLineService_ = orderCreditLineService;
|
134
135
|
}
|
135
136
|
__joinerConfig() {
|
136
137
|
return joiner_config_1.joinerConfig;
|
@@ -156,6 +157,9 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
156
157
|
"original_shipping_tax_total",
|
157
158
|
"original_shipping_subtotal",
|
158
159
|
"original_shipping_total",
|
160
|
+
"credit_line_total",
|
161
|
+
"credit_line_tax_total",
|
162
|
+
"credit_line_subtotal",
|
159
163
|
];
|
160
164
|
const includeTotals = (config?.select ?? []).some((field) => totalFields.includes(field));
|
161
165
|
if (includeTotals) {
|
@@ -167,6 +171,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
167
171
|
config.relations ??= [];
|
168
172
|
config.select ??= [];
|
169
173
|
const requiredRelationsForTotals = [
|
174
|
+
"credit_lines",
|
170
175
|
"items",
|
171
176
|
"items.tax_lines",
|
172
177
|
"items.adjustments",
|
@@ -328,6 +333,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
328
333
|
"billing_address",
|
329
334
|
"summary",
|
330
335
|
"items",
|
336
|
+
"credit_lines",
|
331
337
|
"items.tax_lines",
|
332
338
|
"items.adjustments",
|
333
339
|
"shipping_methods",
|
@@ -341,8 +347,9 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
341
347
|
async createOrders_(data, sharedContext = {}) {
|
342
348
|
await this.createOrderAddresses_(data, sharedContext);
|
343
349
|
const lineItemsToCreate = [];
|
350
|
+
const creditLinesToCreate = [];
|
344
351
|
const createdOrders = [];
|
345
|
-
for (const { items, shipping_methods, ...order } of data) {
|
352
|
+
for (const { items, shipping_methods, credit_lines, ...order } of data) {
|
346
353
|
const ord = order;
|
347
354
|
const shippingMethods = shipping_methods?.map((sm) => {
|
348
355
|
return {
|
@@ -354,6 +361,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
354
361
|
...ord,
|
355
362
|
shipping_methods,
|
356
363
|
items,
|
364
|
+
credit_lines,
|
357
365
|
});
|
358
366
|
const calculated = (0, utils_2.calculateOrderChange)({
|
359
367
|
order: orderWithTotals,
|
@@ -365,6 +373,13 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
365
373
|
totals: calculated.summary,
|
366
374
|
};
|
367
375
|
const created = await this.orderService_.create(ord, sharedContext);
|
376
|
+
creditLinesToCreate.push(...(credit_lines ?? []).map((creditLine) => ({
|
377
|
+
amount: utils_1.MathBN.convert(creditLine.amount),
|
378
|
+
reference: creditLine.reference,
|
379
|
+
reference_id: creditLine.reference_id,
|
380
|
+
metadata: creditLine.metadata,
|
381
|
+
order_id: created.id,
|
382
|
+
})));
|
368
383
|
createdOrders.push(created);
|
369
384
|
if (items?.length) {
|
370
385
|
const orderItems = items.map((item) => {
|
@@ -379,6 +394,9 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
379
394
|
if (lineItemsToCreate.length) {
|
380
395
|
await this.createOrderLineItemsBulk_(lineItemsToCreate, sharedContext);
|
381
396
|
}
|
397
|
+
if (creditLinesToCreate.length) {
|
398
|
+
await this.orderCreditLineService_.create(creditLinesToCreate, sharedContext);
|
399
|
+
}
|
382
400
|
return createdOrders;
|
383
401
|
}
|
384
402
|
async createOrderAddresses_(input, sharedContext = {}) {
|
@@ -698,6 +716,12 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
698
716
|
populate: true,
|
699
717
|
});
|
700
718
|
}
|
719
|
+
async upsertOrderLineItemAdjustments(adjustments, sharedContext = {}) {
|
720
|
+
let result = await this.orderLineItemAdjustmentService_.upsert(adjustments, sharedContext);
|
721
|
+
return await this.baseRepository_.serialize(result, {
|
722
|
+
populate: true,
|
723
|
+
});
|
724
|
+
}
|
701
725
|
async setOrderLineItemAdjustments(orderId, adjustments, sharedContext = {}) {
|
702
726
|
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["items.item.adjustments"] }, sharedContext);
|
703
727
|
const existingAdjustments = (order.items ?? [])
|
@@ -722,6 +746,12 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
722
746
|
populate: true,
|
723
747
|
});
|
724
748
|
}
|
749
|
+
async upsertOrderShippingMethodAdjustments(adjustments, sharedContext = {}) {
|
750
|
+
const result = await this.orderShippingMethodAdjustmentService_.upsert(adjustments, sharedContext);
|
751
|
+
return await this.baseRepository_.serialize(result, {
|
752
|
+
populate: true,
|
753
|
+
});
|
754
|
+
}
|
725
755
|
async setOrderShippingMethodAdjustments(orderId, adjustments, sharedContext = {}) {
|
726
756
|
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["shipping_methods.adjustments"] }, sharedContext);
|
727
757
|
const existingAdjustments = (order.shipping_methods ?? [])
|
@@ -797,6 +827,12 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
797
827
|
}
|
798
828
|
return serialized;
|
799
829
|
}
|
830
|
+
async upsertOrderLineItemTaxLines(taxLines, sharedContext = {}) {
|
831
|
+
const result = await this.orderLineItemTaxLineService_.upsert(taxLines, sharedContext);
|
832
|
+
return await this.baseRepository_.serialize(result, {
|
833
|
+
populate: true,
|
834
|
+
});
|
835
|
+
}
|
800
836
|
async setOrderLineItemTaxLines(orderId, taxLines, sharedContext = {}) {
|
801
837
|
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["items.item.tax_lines"] }, sharedContext);
|
802
838
|
const existingTaxLines = (order.items ?? [])
|
@@ -838,6 +874,12 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
838
874
|
}
|
839
875
|
return serialized;
|
840
876
|
}
|
877
|
+
async upsertOrderShippingMethodTaxLines(taxLines, sharedContext = {}) {
|
878
|
+
const result = await this.orderShippingMethodTaxLineService_.upsert(taxLines, sharedContext);
|
879
|
+
return await this.baseRepository_.serialize(result, {
|
880
|
+
populate: true,
|
881
|
+
});
|
882
|
+
}
|
841
883
|
async setOrderShippingMethodTaxLines(orderId, taxLines, sharedContext = {}) {
|
842
884
|
const order = await this.retrieveOrder(orderId, { select: ["id"], relations: ["shipping_methods.tax_lines"] }, sharedContext);
|
843
885
|
const existingTaxLines = (order.shipping_methods ?? [])
|
@@ -940,17 +982,25 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
940
982
|
async previewOrderChange(orderId, sharedContext) {
|
941
983
|
const order = await this.retrieveOrder(orderId, {
|
942
984
|
select: ["id", "version", "items.detail", "summary", "total"],
|
943
|
-
relations: ["transactions", "
|
985
|
+
relations: ["transactions", "credit_lines"],
|
944
986
|
}, sharedContext);
|
945
987
|
if (!order.order_change) {
|
946
988
|
return order;
|
947
989
|
}
|
948
990
|
const orderChange = await super.retrieveOrderChange(order.order_change.id, { relations: ["actions"] }, sharedContext);
|
949
|
-
const { itemsToUpsert, shippingMethodsToUpsert, calculatedOrders } = (0, utils_2.applyChangesToOrder)([order], { [order.id]: orderChange.actions }, { addActionReferenceToObject: true });
|
991
|
+
const { itemsToUpsert, shippingMethodsToUpsert, calculatedOrders } = await (0, utils_2.applyChangesToOrder)([order], { [order.id]: orderChange.actions }, { addActionReferenceToObject: true });
|
950
992
|
const calculated = calculatedOrders[order.id];
|
993
|
+
await this.includeTaxLinesAndAdjustementsToPreview(calculated.order, itemsToUpsert, shippingMethodsToUpsert, sharedContext);
|
994
|
+
const calcOrder = calculated.order;
|
995
|
+
const orderWithTotals = (0, utils_1.decorateCartTotals)(calcOrder);
|
996
|
+
calcOrder.summary = calculated.getSummaryFromOrder(orderWithTotals);
|
997
|
+
(0, utils_1.createRawPropertiesFromBigNumber)(calcOrder);
|
998
|
+
return calcOrder;
|
999
|
+
}
|
1000
|
+
async includeTaxLinesAndAdjustementsToPreview(order, itemsToUpsert, shippingMethodsToUpsert, sharedContext) {
|
951
1001
|
const addedItems = {};
|
952
1002
|
const addedShippingMethods = {};
|
953
|
-
for (const item of
|
1003
|
+
for (const item of order.items) {
|
954
1004
|
const isExistingItem = item.id === item.detail?.item_id;
|
955
1005
|
if (!isExistingItem) {
|
956
1006
|
addedItems[item.id] = {
|
@@ -963,7 +1013,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
963
1013
|
};
|
964
1014
|
}
|
965
1015
|
}
|
966
|
-
for (const sm of
|
1016
|
+
for (const sm of order.shipping_methods) {
|
967
1017
|
if (!(0, utils_1.isDefined)(sm.shipping_option_id)) {
|
968
1018
|
addedShippingMethods[sm.id] = sm;
|
969
1019
|
}
|
@@ -972,7 +1022,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
972
1022
|
const addedItemDetails = await this.listOrderLineItems({ id: Object.keys(addedItems) }, {
|
973
1023
|
relations: ["adjustments", "tax_lines"],
|
974
1024
|
}, sharedContext);
|
975
|
-
|
1025
|
+
order.items.forEach((item, idx) => {
|
976
1026
|
if (!addedItems[item.id]) {
|
977
1027
|
return;
|
978
1028
|
}
|
@@ -983,7 +1033,9 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
983
1033
|
const newItem = itemsToUpsert.find((d) => d.item_id === item.id);
|
984
1034
|
const unitPrice = newItem?.unit_price ?? item.unit_price;
|
985
1035
|
const compareAtUnitPrice = newItem?.compare_at_unit_price ?? item.compare_at_unit_price;
|
986
|
-
|
1036
|
+
delete lineItem.raw_unit_price;
|
1037
|
+
delete lineItem.raw_compare_at_unit_price;
|
1038
|
+
order.items[idx] = {
|
987
1039
|
...lineItem,
|
988
1040
|
actions,
|
989
1041
|
quantity: newItem.quantity,
|
@@ -1000,7 +1052,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1000
1052
|
const addedShippingDetails = await this.listOrderShippingMethods({ id: Object.keys(addedShippingMethods) }, {
|
1001
1053
|
relations: ["adjustments", "tax_lines"],
|
1002
1054
|
}, sharedContext);
|
1003
|
-
|
1055
|
+
order.shipping_methods.forEach((sm, idx) => {
|
1004
1056
|
if (!addedShippingMethods[sm.id]) {
|
1005
1057
|
return;
|
1006
1058
|
}
|
@@ -1010,7 +1062,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1010
1062
|
const newItem = shippingMethodsToUpsert.find((d) => d.id === sm.id);
|
1011
1063
|
sm.shipping_method_id = sm.id;
|
1012
1064
|
delete sm.id;
|
1013
|
-
|
1065
|
+
order.shipping_methods[idx] = {
|
1014
1066
|
...shippingMethod,
|
1015
1067
|
actions,
|
1016
1068
|
detail: {
|
@@ -1020,11 +1072,6 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1020
1072
|
};
|
1021
1073
|
});
|
1022
1074
|
}
|
1023
|
-
const calcOrder = calculated.order;
|
1024
|
-
(0, utils_1.decorateCartTotals)(calcOrder);
|
1025
|
-
calcOrder.summary = calculated.summary;
|
1026
|
-
(0, utils_1.createRawPropertiesFromBigNumber)(calcOrder);
|
1027
|
-
return calcOrder;
|
1028
1075
|
}
|
1029
1076
|
async cancelOrderChange(orderChangeIdOrData, sharedContext) {
|
1030
1077
|
const data = Array.isArray(orderChangeIdOrData)
|
@@ -1399,25 +1446,22 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1399
1446
|
if (!ordersIds.length) {
|
1400
1447
|
return {
|
1401
1448
|
items: [],
|
1402
|
-
|
1449
|
+
shipping_methods: [],
|
1450
|
+
credit_lines: [],
|
1403
1451
|
};
|
1404
1452
|
}
|
1405
1453
|
let orders = await this.listOrders({ id: (0, utils_1.deduplicate)(ordersIds) }, {
|
1406
1454
|
select: ["id", "version", "items.detail", "summary", "total"],
|
1407
|
-
relations: [
|
1408
|
-
"transactions",
|
1409
|
-
"items",
|
1410
|
-
"items.detail",
|
1411
|
-
"shipping_methods",
|
1412
|
-
],
|
1455
|
+
relations: ["transactions", "credit_lines"],
|
1413
1456
|
}, sharedContext);
|
1414
|
-
|
1415
|
-
entity: _models_1.Order,
|
1416
|
-
});
|
1417
|
-
const { itemsToUpsert, shippingMethodsToUpsert, summariesToUpsert, orderToUpdate, } = (0, utils_2.applyChangesToOrder)(orders, actionsMap, {
|
1457
|
+
const { itemsToUpsert, shippingMethodsToUpsert, summariesToUpsert, orderToUpdate, creditLinesToCreate, } = await (0, utils_2.applyChangesToOrder)(orders, actionsMap, {
|
1418
1458
|
addActionReferenceToObject: true,
|
1459
|
+
includeTaxLinesAndAdjustementsToPreview: async (...args) => {
|
1460
|
+
args.push(sharedContext);
|
1461
|
+
return await this.includeTaxLinesAndAdjustementsToPreview.apply(this, args);
|
1462
|
+
},
|
1419
1463
|
});
|
1420
|
-
await (0, utils_1.promiseAll)([
|
1464
|
+
const [_orderUpdate, _orderChangeActionUpdate, orderItems, _orderSummaryUpdate, orderShippingMethods, createdOrderCreditLines,] = await (0, utils_1.promiseAll)([
|
1421
1465
|
orderToUpdate.length
|
1422
1466
|
? this.orderService_.update(orderToUpdate, sharedContext)
|
1423
1467
|
: null,
|
@@ -1433,10 +1477,14 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1433
1477
|
shippingMethodsToUpsert.length
|
1434
1478
|
? this.orderShippingService_.upsert(shippingMethodsToUpsert, sharedContext)
|
1435
1479
|
: null,
|
1480
|
+
creditLinesToCreate.length
|
1481
|
+
? this.orderCreditLineService_.create(creditLinesToCreate, sharedContext)
|
1482
|
+
: null,
|
1436
1483
|
]);
|
1437
1484
|
return {
|
1438
|
-
items:
|
1439
|
-
|
1485
|
+
items: orderItems ?? [],
|
1486
|
+
shipping_methods: orderShippingMethods ?? [],
|
1487
|
+
credit_lines: createdOrderCreditLines ?? [],
|
1440
1488
|
};
|
1441
1489
|
}
|
1442
1490
|
async addOrderTransactions(transactionData, sharedContext) {
|
@@ -1481,7 +1529,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1481
1529
|
const transactions = await super.listOrderTransactions({
|
1482
1530
|
id: transactionIds,
|
1483
1531
|
}, {
|
1484
|
-
select: ["order_id", "amount"],
|
1532
|
+
select: ["order_id", "version", "amount"],
|
1485
1533
|
}, sharedContext);
|
1486
1534
|
const returned = await super.softDeleteOrderTransactions(transactionIds, config, sharedContext);
|
1487
1535
|
await this.updateOrderPaidRefundableAmount_(transactions, true, sharedContext);
|
@@ -1492,7 +1540,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1492
1540
|
const transactions = await super.listOrderTransactions({
|
1493
1541
|
id: transactionIds,
|
1494
1542
|
}, {
|
1495
|
-
select: ["order_id", "amount"],
|
1543
|
+
select: ["order_id", "version", "amount"],
|
1496
1544
|
withDeleted: true,
|
1497
1545
|
}, sharedContext);
|
1498
1546
|
const returned = await super.restoreOrderTransactions(transactionIds, config, sharedContext);
|
@@ -1502,6 +1550,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1502
1550
|
async updateOrderPaidRefundableAmount_(transactionData, isRemoved, sharedContext) {
|
1503
1551
|
const summaries = await super.listOrderSummaries({
|
1504
1552
|
order_id: transactionData.map((trx) => trx.order_id),
|
1553
|
+
version: transactionData[0].version,
|
1505
1554
|
}, {}, sharedContext);
|
1506
1555
|
summaries.forEach((summary) => {
|
1507
1556
|
let trxs = transactionData.filter((trx) => trx.order_id === summary.order_id);
|
@@ -1510,6 +1559,7 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1510
1559
|
}
|
1511
1560
|
(0, utils_1.transformPropertiesToBigNumber)(trxs);
|
1512
1561
|
const op = isRemoved ? utils_1.MathBN.sub : utils_1.MathBN.add;
|
1562
|
+
const initialTrxTotal = summary.totals.transaction_total;
|
1513
1563
|
for (const trx of trxs) {
|
1514
1564
|
if (utils_1.MathBN.gt(trx.amount, 0)) {
|
1515
1565
|
summary.totals.paid_total = new utils_1.BigNumber(op(summary.totals.paid_total, trx.amount));
|
@@ -1519,7 +1569,8 @@ class OrderModuleService extends utils_1.ModulesSdkUtils.MedusaService(generateM
|
|
1519
1569
|
}
|
1520
1570
|
summary.totals.transaction_total = new utils_1.BigNumber(op(summary.totals.transaction_total, trx.amount));
|
1521
1571
|
}
|
1522
|
-
|
1572
|
+
const initialDiff = utils_1.MathBN.sub(summary.totals.transaction_total, initialTrxTotal);
|
1573
|
+
summary.totals.pending_difference = new utils_1.BigNumber(utils_1.MathBN.sub(summary.totals.pending_difference, initialDiff));
|
1523
1574
|
});
|
1524
1575
|
(0, utils_1.createRawPropertiesFromBigNumber)(summaries);
|
1525
1576
|
await this.orderSummaryService_.update(summaries, sharedContext);
|
@@ -1963,6 +2014,13 @@ __decorate([
|
|
1963
2014
|
__metadata("design:paramtypes", [Object, Array, Object]),
|
1964
2015
|
__metadata("design:returntype", Promise)
|
1965
2016
|
], OrderModuleService.prototype, "createOrderLineItemAdjustments", null);
|
2017
|
+
__decorate([
|
2018
|
+
(0, utils_1.InjectTransactionManager)(),
|
2019
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
2020
|
+
__metadata("design:type", Function),
|
2021
|
+
__metadata("design:paramtypes", [Array, Object]),
|
2022
|
+
__metadata("design:returntype", Promise)
|
2023
|
+
], OrderModuleService.prototype, "upsertOrderLineItemAdjustments", null);
|
1966
2024
|
__decorate([
|
1967
2025
|
(0, utils_1.InjectTransactionManager)(),
|
1968
2026
|
__param(2, (0, utils_1.MedusaContext)()),
|
@@ -1970,6 +2028,13 @@ __decorate([
|
|
1970
2028
|
__metadata("design:paramtypes", [String, Array, Object]),
|
1971
2029
|
__metadata("design:returntype", Promise)
|
1972
2030
|
], OrderModuleService.prototype, "setOrderLineItemAdjustments", null);
|
2031
|
+
__decorate([
|
2032
|
+
(0, utils_1.InjectTransactionManager)(),
|
2033
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
2034
|
+
__metadata("design:type", Function),
|
2035
|
+
__metadata("design:paramtypes", [Array, Object]),
|
2036
|
+
__metadata("design:returntype", Promise)
|
2037
|
+
], OrderModuleService.prototype, "upsertOrderShippingMethodAdjustments", null);
|
1973
2038
|
__decorate([
|
1974
2039
|
(0, utils_1.InjectTransactionManager)(),
|
1975
2040
|
__param(2, (0, utils_1.MedusaContext)()),
|
@@ -1995,6 +2060,13 @@ __decorate([
|
|
1995
2060
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
1996
2061
|
__metadata("design:returntype", Promise)
|
1997
2062
|
], OrderModuleService.prototype, "createOrderLineItemTaxLines", null);
|
2063
|
+
__decorate([
|
2064
|
+
(0, utils_1.InjectTransactionManager)(),
|
2065
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
2066
|
+
__metadata("design:type", Function),
|
2067
|
+
__metadata("design:paramtypes", [Array, Object]),
|
2068
|
+
__metadata("design:returntype", Promise)
|
2069
|
+
], OrderModuleService.prototype, "upsertOrderLineItemTaxLines", null);
|
1998
2070
|
__decorate([
|
1999
2071
|
(0, utils_1.InjectTransactionManager)(),
|
2000
2072
|
__param(2, (0, utils_1.MedusaContext)()),
|
@@ -2011,6 +2083,13 @@ __decorate([
|
|
2011
2083
|
__metadata("design:paramtypes", [Object, Object, Object]),
|
2012
2084
|
__metadata("design:returntype", Promise)
|
2013
2085
|
], OrderModuleService.prototype, "createOrderShippingMethodTaxLines", null);
|
2086
|
+
__decorate([
|
2087
|
+
(0, utils_1.InjectTransactionManager)(),
|
2088
|
+
__param(1, (0, utils_1.MedusaContext)()),
|
2089
|
+
__metadata("design:type", Function),
|
2090
|
+
__metadata("design:paramtypes", [Array, Object]),
|
2091
|
+
__metadata("design:returntype", Promise)
|
2092
|
+
], OrderModuleService.prototype, "upsertOrderShippingMethodTaxLines", null);
|
2014
2093
|
__decorate([
|
2015
2094
|
(0, utils_1.InjectTransactionManager)(),
|
2016
2095
|
__param(2, (0, utils_1.MedusaContext)()),
|