@medusajs/order 0.1.3-snapshot-20240607093839 → 0.1.3-snapshot-20240701122250

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +7 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/joiner-config.d.ts +1 -3
  5. package/dist/joiner-config.js +4 -42
  6. package/dist/joiner-config.js.map +1 -1
  7. package/dist/migrations/Migration20240604100512.d.ts +4 -0
  8. package/dist/migrations/Migration20240604100512.js +364 -0
  9. package/dist/migrations/Migration20240604100512.js.map +1 -0
  10. package/dist/models/claim-item-image.d.ts +18 -0
  11. package/dist/models/claim-item-image.js +108 -0
  12. package/dist/models/claim-item-image.js.map +1 -0
  13. package/dist/models/claim-item.d.ts +28 -0
  14. package/dist/models/claim-item.js +156 -0
  15. package/dist/models/claim-item.js.map +1 -0
  16. package/dist/models/claim.d.ts +35 -0
  17. package/dist/models/claim.js +196 -0
  18. package/dist/models/claim.js.map +1 -0
  19. package/dist/models/exchange-item.d.ts +23 -0
  20. package/dist/models/exchange-item.js +138 -0
  21. package/dist/models/exchange-item.js.map +1 -0
  22. package/dist/models/exchange.d.ts +33 -0
  23. package/dist/models/exchange.js +189 -0
  24. package/dist/models/exchange.js.map +1 -0
  25. package/dist/models/index.d.ts +7 -0
  26. package/dist/models/index.js +15 -1
  27. package/dist/models/index.js.map +1 -1
  28. package/dist/models/line-item-adjustment.d.ts +2 -1
  29. package/dist/models/line-item-adjustment.js +1 -1
  30. package/dist/models/line-item-adjustment.js.map +1 -1
  31. package/dist/models/line-item-tax-line.d.ts +2 -1
  32. package/dist/models/line-item-tax-line.js +1 -1
  33. package/dist/models/line-item-tax-line.js.map +1 -1
  34. package/dist/models/line-item.d.ts +1 -1
  35. package/dist/models/line-item.js +3 -3
  36. package/dist/models/line-item.js.map +1 -1
  37. package/dist/models/order-change-action.d.ts +13 -3
  38. package/dist/models/order-change-action.js +94 -0
  39. package/dist/models/order-change-action.js.map +1 -1
  40. package/dist/models/order-change.d.ts +14 -3
  41. package/dist/models/order-change.js +107 -3
  42. package/dist/models/order-change.js.map +1 -1
  43. package/dist/models/order-item.d.ts +3 -3
  44. package/dist/models/order-item.js +7 -7
  45. package/dist/models/order-item.js.map +1 -1
  46. package/dist/models/order-shipping-method.d.ts +12 -3
  47. package/dist/models/order-shipping-method.js +83 -7
  48. package/dist/models/order-shipping-method.js.map +1 -1
  49. package/dist/models/order-summary.d.ts +3 -2
  50. package/dist/models/order-summary.js +7 -4
  51. package/dist/models/order-summary.js.map +1 -1
  52. package/dist/models/order.d.ts +3 -3
  53. package/dist/models/order.js +1 -1
  54. package/dist/models/order.js.map +1 -1
  55. package/dist/models/return-item.d.ts +28 -0
  56. package/dist/models/return-item.js +170 -0
  57. package/dist/models/return-item.js.map +1 -0
  58. package/dist/models/return-reason.d.ts +3 -3
  59. package/dist/models/return-reason.js.map +1 -1
  60. package/dist/models/return.d.ts +38 -0
  61. package/dist/models/return.js +213 -0
  62. package/dist/models/return.js.map +1 -0
  63. package/dist/models/shipping-method-adjustment.d.ts +2 -1
  64. package/dist/models/shipping-method-adjustment.js +1 -1
  65. package/dist/models/shipping-method-adjustment.js.map +1 -1
  66. package/dist/models/shipping-method-tax-line.d.ts +2 -1
  67. package/dist/models/shipping-method-tax-line.js +1 -1
  68. package/dist/models/shipping-method-tax-line.js.map +1 -1
  69. package/dist/models/shipping-method.js +1 -1
  70. package/dist/models/shipping-method.js.map +1 -1
  71. package/dist/models/tax-line.js.map +1 -1
  72. package/dist/models/transaction.d.ts +11 -2
  73. package/dist/models/transaction.js +80 -1
  74. package/dist/models/transaction.js.map +1 -1
  75. package/dist/repositories/claim.d.ts +8 -0
  76. package/dist/repositories/claim.js +11 -0
  77. package/dist/repositories/claim.js.map +1 -0
  78. package/dist/repositories/exchange.d.ts +8 -0
  79. package/dist/repositories/exchange.js +11 -0
  80. package/dist/repositories/exchange.js.map +1 -0
  81. package/dist/repositories/index.d.ts +3 -1
  82. package/dist/repositories/index.js +7 -16
  83. package/dist/repositories/index.js.map +1 -1
  84. package/dist/repositories/order.d.ts +0 -3
  85. package/dist/repositories/order.js +2 -83
  86. package/dist/repositories/order.js.map +1 -1
  87. package/dist/repositories/return.d.ts +8 -0
  88. package/dist/repositories/return.js +11 -0
  89. package/dist/repositories/return.js.map +1 -0
  90. package/dist/services/actions/cancel-fulfillment.d.ts +2 -0
  91. package/dist/services/actions/cancel-fulfillment.js +32 -0
  92. package/dist/services/actions/cancel-fulfillment.js.map +1 -0
  93. package/dist/services/actions/create-claim.d.ts +2 -0
  94. package/dist/services/actions/create-claim.js +229 -0
  95. package/dist/services/actions/create-claim.js.map +1 -0
  96. package/dist/services/actions/create-exchange.d.ts +2 -0
  97. package/dist/services/actions/create-exchange.js +194 -0
  98. package/dist/services/actions/create-exchange.js.map +1 -0
  99. package/dist/services/actions/create-return.d.ts +2 -0
  100. package/dist/services/actions/create-return.js +98 -0
  101. package/dist/services/actions/create-return.js.map +1 -0
  102. package/dist/services/actions/index.d.ts +7 -0
  103. package/dist/services/actions/index.js +24 -0
  104. package/dist/services/actions/index.js.map +1 -0
  105. package/dist/services/actions/receive-return.d.ts +2 -0
  106. package/dist/services/actions/receive-return.js +75 -0
  107. package/dist/services/actions/receive-return.js.map +1 -0
  108. package/dist/services/actions/register-fulfillment.d.ts +2 -0
  109. package/dist/services/actions/register-fulfillment.js +30 -0
  110. package/dist/services/actions/register-fulfillment.js.map +1 -0
  111. package/dist/services/actions/register-shipment.d.ts +2 -0
  112. package/dist/services/actions/register-shipment.js +38 -0
  113. package/dist/services/actions/register-shipment.js.map +1 -0
  114. package/dist/services/order-change-service.d.ts +6 -6
  115. package/dist/services/order-change-service.js +4 -3
  116. package/dist/services/order-change-service.js.map +1 -1
  117. package/dist/services/order-module-service.d.ts +101 -64
  118. package/dist/services/order-module-service.js +458 -295
  119. package/dist/services/order-module-service.js.map +1 -1
  120. package/dist/services/order-service.d.ts +4 -4
  121. package/dist/services/order-service.js +1 -1
  122. package/dist/services/order-service.js.map +1 -1
  123. package/dist/types/index.d.ts +1 -0
  124. package/dist/types/index.js +1 -0
  125. package/dist/types/index.js.map +1 -1
  126. package/dist/types/order-change.d.ts +32 -0
  127. package/dist/types/order-change.js +34 -0
  128. package/dist/types/order-change.js.map +1 -0
  129. package/dist/types/utils/index.d.ts +25 -1
  130. package/dist/types/utils/index.js.map +1 -1
  131. package/dist/utils/actions/cancel-item-fulfillment.js +2 -0
  132. package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -1
  133. package/dist/utils/actions/cancel-return.js +2 -0
  134. package/dist/utils/actions/cancel-return.js.map +1 -1
  135. package/dist/utils/actions/fulfill-item.js +2 -0
  136. package/dist/utils/actions/fulfill-item.js.map +1 -1
  137. package/dist/utils/actions/index.d.ts +1 -0
  138. package/dist/utils/actions/index.js +1 -0
  139. package/dist/utils/actions/index.js.map +1 -1
  140. package/dist/utils/actions/item-add.js +10 -7
  141. package/dist/utils/actions/item-add.js.map +1 -1
  142. package/dist/utils/actions/item-remove.js +6 -4
  143. package/dist/utils/actions/item-remove.js.map +1 -1
  144. package/dist/utils/actions/receive-damaged-return-item.js +2 -0
  145. package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
  146. package/dist/utils/actions/receive-return-item.js +2 -0
  147. package/dist/utils/actions/receive-return-item.js.map +1 -1
  148. package/dist/utils/actions/return-item.js +2 -0
  149. package/dist/utils/actions/return-item.js.map +1 -1
  150. package/dist/utils/actions/ship-item.js +2 -0
  151. package/dist/utils/actions/ship-item.js.map +1 -1
  152. package/dist/utils/actions/shipping-add.js +6 -2
  153. package/dist/utils/actions/shipping-add.js.map +1 -1
  154. package/dist/utils/actions/write-off-item.js +2 -0
  155. package/dist/utils/actions/write-off-item.js.map +1 -1
  156. package/dist/utils/apply-order-changes.d.ts +14 -0
  157. package/dist/utils/apply-order-changes.js +74 -0
  158. package/dist/utils/apply-order-changes.js.map +1 -0
  159. package/dist/utils/base-repository-find.d.ts +2 -0
  160. package/dist/utils/base-repository-find.js +117 -0
  161. package/dist/utils/base-repository-find.js.map +1 -0
  162. package/dist/utils/calculate-order-change.js +5 -1
  163. package/dist/utils/calculate-order-change.js.map +1 -1
  164. package/dist/utils/index.d.ts +3 -0
  165. package/dist/utils/index.js +3 -0
  166. package/dist/utils/index.js.map +1 -1
  167. package/dist/utils/set-action-reference.d.ts +1 -0
  168. package/dist/utils/set-action-reference.js +11 -0
  169. package/dist/utils/set-action-reference.js.map +1 -0
  170. package/dist/utils/transform-order.d.ts +3 -2
  171. package/dist/utils/transform-order.js +84 -17
  172. package/dist/utils/transform-order.js.map +1 -1
  173. package/package.json +7 -11
  174. package/dist/module-definition.d.ts +0 -2
  175. package/dist/module-definition.js +0 -9
  176. package/dist/module-definition.js.map +0 -1
  177. package/dist/scripts/bin/run-seed.d.ts +0 -3
  178. package/dist/scripts/bin/run-seed.js +0 -49
  179. package/dist/scripts/bin/run-seed.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-claim.js","sourceRoot":"","sources":["../../../src/services/actions/create-claim.ts"],"names":[],"mappings":";;;AAKA,2CAMwB;AACxB,qCAAmE;AACnE,mCAAwC;AACxC,uCAA8C;AAE9C,SAAS,4BAA4B,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK;IACnD,MAAM,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAU,EAAE;QAC3C,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,aAAa,EAAE,KAAK,CAAC,OAAO;QAC5B,IAAI,EAAE,IAAI,CAAC,IAAiB;QAC5B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,aAAa,EAAG,IAAI,CAAC,aAAyB,IAAI,IAAI;KACvD,CAAC,CAAA;IAEF,MAAM,eAAe,GACnB,IAAI,CAAC,IAAI,KAAK,iBAAS,CAAC,OAAO;QAC7B,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,gBAAM,EAAE;YAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,aA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J,IAAI,EACJ,KAAK,EACL,cAAc,EACd,OAAO,EACP,aAAa,CACd,CAAA;IACD,MAAM,sBAAsB,CAC1B,IAAI,EACJ,IAAI,EACJ,cAAc,EACd,OAAO,EACP,aAAa,CACd,CAAA;IACD,MAAM,qBAAqB,CACzB,IAAI,EACJ,IAAI,EACJ,cAAc,EACd,eAAe,EACf,OAAO,EACP,aAAa,CACd,CAAA;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ,EAAE,cAAc,CAAC,EAAE;QAC3B,SAAS,EAAE,eAAe,CAAC,EAAE;QAC7B,WAAW,EAAE,wBAAe,CAAC,KAAK;QAClC,SAAS,EAAE,OAAO;QAClB,YAAY,EAAE,cAAc,CAAC,EAAE;QAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO;KACR,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAA,kBAAU,EAAC;QACf,IAAI,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC;QACpD,IAAI,CAAC,iBAAiB,CAAC,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC;QACvD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC;KACrD,CAAC,CAAA;IAEF,OAAO,cAAc,CAAA;AACvB,CAAC;AAjFD,kCAiFC"}
@@ -0,0 +1,2 @@
1
+ import { Context, OrderTypes } from "@medusajs/types";
2
+ export declare function createExchange(this: any, data: OrderTypes.CreateOrderExchangeDTO, sharedContext?: Context): Promise<any>;
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createExchange = void 0;
4
+ const utils_1 = require("@medusajs/utils");
5
+ const _models_1 = require("../../models");
6
+ const _types_1 = require("../../types");
7
+ const utils_2 = require("../../utils");
8
+ function createExchangeAndReturnEntities(em, data, order) {
9
+ const exchangeReference = em.create(_models_1.OrderExchange, {
10
+ order_id: data.order_id,
11
+ order_version: order.version,
12
+ no_notification: data.no_notification,
13
+ allow_backorder: data.allow_backorder,
14
+ difference_due: data.difference_due,
15
+ });
16
+ const returnReference = em.create(_models_1.Return, {
17
+ order_id: data.order_id,
18
+ order_version: order.version,
19
+ status: utils_1.ReturnStatus.REQUESTED,
20
+ exchange_id: exchangeReference.id,
21
+ refund_amount: data.refund_amount ?? null,
22
+ });
23
+ exchangeReference.return_id = returnReference.id;
24
+ return { exchangeReference, returnReference };
25
+ }
26
+ function createReturnItems(em, data, exchangeReference, returnReference, actions) {
27
+ return data.return_items?.map((item) => {
28
+ actions.push({
29
+ action: utils_2.ChangeActionType.RETURN_ITEM,
30
+ reference: "return",
31
+ reference_id: returnReference.id,
32
+ details: {
33
+ reference_id: item.id,
34
+ return_id: returnReference.id,
35
+ exchange_id: exchangeReference.id,
36
+ quantity: item.quantity,
37
+ metadata: item.metadata,
38
+ },
39
+ });
40
+ return em.create(_models_1.ReturnItem, {
41
+ item_id: item.id,
42
+ return_id: returnReference.id,
43
+ reason: item.reason,
44
+ quantity: item.quantity,
45
+ note: item.note,
46
+ metadata: item.metadata,
47
+ });
48
+ });
49
+ }
50
+ async function processAdditionalItems(em, service, data, order, exchangeReference, actions, sharedContext) {
51
+ const itemsToAdd = [];
52
+ const additionalNewItems = [];
53
+ const additionalItems = [];
54
+ data.additional_items?.forEach((item) => {
55
+ const hasItem = item.id
56
+ ? order.items.find((o) => o.item.id === item.id)
57
+ : false;
58
+ if (hasItem) {
59
+ actions.push({
60
+ action: utils_2.ChangeActionType.ITEM_ADD,
61
+ exchange_id: exchangeReference.id,
62
+ internal_note: item.internal_note,
63
+ reference: "exchange",
64
+ reference_id: exchangeReference.id,
65
+ details: {
66
+ reference_id: item.id,
67
+ exchange_id: exchangeReference.id,
68
+ quantity: item.quantity,
69
+ metadata: item.metadata,
70
+ },
71
+ });
72
+ additionalItems.push(em.create(_models_1.ExchangeItem, {
73
+ item_id: item.id,
74
+ quantity: item.quantity,
75
+ note: item.note,
76
+ metadata: item.metadata,
77
+ is_additional_item: true,
78
+ }));
79
+ }
80
+ else {
81
+ itemsToAdd.push(item);
82
+ additionalNewItems.push(em.create(_models_1.ExchangeItem, {
83
+ quantity: item.quantity,
84
+ note: item.note,
85
+ metadata: item.metadata,
86
+ is_additional_item: true,
87
+ }));
88
+ }
89
+ });
90
+ const createItems = await service.lineItemService_.create(itemsToAdd, sharedContext);
91
+ createItems.forEach((item, index) => {
92
+ const addedItem = itemsToAdd[index];
93
+ additionalNewItems[index].item_id = item.id;
94
+ actions.push({
95
+ action: utils_2.ChangeActionType.ITEM_ADD,
96
+ exchange_id: exchangeReference.id,
97
+ internal_note: addedItem.internal_note,
98
+ reference: "exchange",
99
+ reference_id: exchangeReference.id,
100
+ details: {
101
+ reference_id: item.id,
102
+ exchange_id: exchangeReference.id,
103
+ quantity: addedItem.quantity,
104
+ metadata: addedItem.metadata,
105
+ },
106
+ });
107
+ });
108
+ return additionalNewItems.concat(additionalItems);
109
+ }
110
+ async function processShippingMethods(service, data, exchangeReference, actions, sharedContext) {
111
+ for (const shippingMethod of data.shipping_methods ?? []) {
112
+ let shippingMethodId;
113
+ if (!(0, utils_1.isString)(shippingMethod)) {
114
+ const methods = await service.createShippingMethods([
115
+ {
116
+ order_id: data.order_id,
117
+ exchange_id: exchangeReference.id,
118
+ ...shippingMethod,
119
+ },
120
+ ], sharedContext);
121
+ shippingMethodId = methods[0].id;
122
+ }
123
+ else {
124
+ shippingMethodId = shippingMethod;
125
+ }
126
+ const method = await service.retrieveShippingMethod(shippingMethodId, { relations: ["tax_lines", "adjustments"] }, sharedContext);
127
+ const calculatedAmount = (0, utils_1.getShippingMethodsTotals)([method], {})[method.id];
128
+ actions.push({
129
+ action: utils_2.ChangeActionType.SHIPPING_ADD,
130
+ reference: "order_shipping_method",
131
+ reference_id: shippingMethodId,
132
+ exchange_id: exchangeReference.id,
133
+ amount: calculatedAmount.total,
134
+ });
135
+ }
136
+ }
137
+ async function processReturnShipping(service, data, exchangeReference, returnReference, actions, sharedContext) {
138
+ let returnShippingMethodId;
139
+ if (!(0, utils_1.isString)(data.return_shipping)) {
140
+ const methods = await service.createShippingMethods([
141
+ {
142
+ order_id: data.order_id,
143
+ exchange_id: exchangeReference.id,
144
+ return_id: returnReference.id,
145
+ ...data.return_shipping,
146
+ },
147
+ ], sharedContext);
148
+ returnShippingMethodId = methods[0].id;
149
+ }
150
+ else {
151
+ returnShippingMethodId = data.return_shipping;
152
+ }
153
+ const method = await service.retrieveShippingMethod(returnShippingMethodId, { relations: ["tax_lines", "adjustments"] }, sharedContext);
154
+ const calculatedAmount = (0, utils_1.getShippingMethodsTotals)([method], {})[method.id];
155
+ actions.push({
156
+ action: utils_2.ChangeActionType.SHIPPING_ADD,
157
+ reference: "order_shipping_method",
158
+ reference_id: returnShippingMethodId,
159
+ return_id: returnReference.id,
160
+ exchange_id: exchangeReference.id,
161
+ amount: calculatedAmount.total,
162
+ });
163
+ }
164
+ async function createExchange(data, sharedContext) {
165
+ const order = await this.orderService_.retrieve(data.order_id, { relations: ["items"] }, sharedContext);
166
+ const actions = [];
167
+ const em = sharedContext.transactionManager;
168
+ const { exchangeReference, returnReference } = createExchangeAndReturnEntities(em, data, order);
169
+ returnReference.items = createReturnItems(em, data, exchangeReference, returnReference, actions);
170
+ exchangeReference.additional_items = await processAdditionalItems(em, this, data, order, exchangeReference, actions, sharedContext);
171
+ await processShippingMethods(this, data, exchangeReference, actions, sharedContext);
172
+ await processReturnShipping(this, data, exchangeReference, returnReference, actions, sharedContext);
173
+ const change = await this.createOrderChange_({
174
+ order_id: data.order_id,
175
+ exchange_id: exchangeReference.id,
176
+ return_id: returnReference.id,
177
+ change_type: _types_1.OrderChangeType.EXCHANGE,
178
+ reference: "exchange",
179
+ reference_id: exchangeReference.id,
180
+ description: data.description,
181
+ internal_note: data.internal_note,
182
+ created_by: data.created_by,
183
+ metadata: data.metadata,
184
+ actions,
185
+ }, sharedContext);
186
+ await (0, utils_1.promiseAll)([
187
+ this.createReturns([returnReference], sharedContext),
188
+ this.createOrderExchanges([exchangeReference], sharedContext),
189
+ this.confirmOrderChange(change[0].id, sharedContext),
190
+ ]);
191
+ return exchangeReference;
192
+ }
193
+ exports.createExchange = createExchange;
194
+ //# sourceMappingURL=create-exchange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-exchange.js","sourceRoot":"","sources":["../../../src/services/actions/create-exchange.ts"],"names":[],"mappings":";;;AAKA,2CAKwB;AACxB,qCAAyE;AACzE,mCAAwC;AACxC,uCAA8C;AAE9C,SAAS,+BAA+B,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK;IACtD,MAAM,iBAAiB,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAa,EAAE;QACjD,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,aAAa,EAAE,KAAK,CAAC,OAAO;QAC5B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,cAAc,EAAE,IAAI,CAAC,cAAc;KACpC,CAAC,CAAA;IAEF,MAAM,eAAe,GAAG,EAAE,CAAC,MAAM,CAAC,gBAAM,EAAE;QACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,aAAa,EAAE,KAAK,CAAC,OAAO;QAC5B,MAAM,EAAE,oBAAY,CAAC,SAAS;QAC9B,WAAW,EAAE,iBAAiB,CAAC,EAAE;QACjC,aAAa,EAAG,IAAI,CAAC,aAAyB,IAAI,IAAI;KACvD,CAAC,CAAA;IAEF,iBAAiB,CAAC,SAAS,GAAG,eAAe,CAAC,EAAE,CAAA;IAEhD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAA;AA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B,IAAI,EACJ,IAAI,EACJ,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,aAAa,CACd,CAAA;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,iBAAiB,CAAC,EAAE;QACjC,SAAS,EAAE,eAAe,CAAC,EAAE;QAC7B,WAAW,EAAE,wBAAe,CAAC,QAAQ;QACrC,SAAS,EAAE,UAAU;QACrB,YAAY,EAAE,iBAAiB,CAAC,EAAE;QAClC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO;KACR,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAA,kBAAU,EAAC;QACf,IAAI,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC;QACpD,IAAI,CAAC,oBAAoB,CAAC,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAC7D,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC;KACrD,CAAC,CAAA;IAEF,OAAO,iBAAiB,CAAA;AAC1B,CAAC;AAxED,wCAwEC"}
@@ -0,0 +1,2 @@
1
+ import { Context, OrderTypes } from "@medusajs/types";
2
+ export declare function createReturn(this: any, data: OrderTypes.CreateOrderReturnDTO, sharedContext?: Context): Promise<any>;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createReturn = void 0;
4
+ const utils_1 = require("@medusajs/utils");
5
+ const _models_1 = require("../../models");
6
+ const _types_1 = require("../../types");
7
+ const utils_2 = require("../../utils");
8
+ function createReturnReference(em, data, order) {
9
+ return em.create(_models_1.Return, {
10
+ order_id: data.order_id,
11
+ order_version: order.version,
12
+ status: utils_1.ReturnStatus.REQUESTED,
13
+ no_notification: data.no_notification,
14
+ refund_amount: data.refund_amount ?? null,
15
+ });
16
+ }
17
+ function createReturnItems(em, data, returnRef, actions) {
18
+ return data.items.map((item) => {
19
+ actions.push({
20
+ action: utils_2.ChangeActionType.RETURN_ITEM,
21
+ return_id: returnRef.id,
22
+ internal_note: item.internal_note,
23
+ reference: "return",
24
+ reference_id: returnRef.id,
25
+ details: {
26
+ reference_id: item.id,
27
+ return_id: returnRef.id,
28
+ quantity: item.quantity,
29
+ metadata: item.metadata,
30
+ },
31
+ });
32
+ return em.create(_models_1.ReturnItem, {
33
+ reason_id: item.reason_id,
34
+ return_id: returnRef.id,
35
+ item_id: item.id,
36
+ quantity: item.quantity,
37
+ note: item.note,
38
+ metadata: item.metadata,
39
+ });
40
+ });
41
+ }
42
+ async function processShippingMethod(service, data, returnRef, actions, sharedContext) {
43
+ let shippingMethodId;
44
+ if (!(0, utils_1.isString)(data.shipping_method)) {
45
+ const methods = await service.createShippingMethods([
46
+ {
47
+ order_id: data.order_id,
48
+ return_id: returnRef.id,
49
+ ...data.shipping_method,
50
+ },
51
+ ], sharedContext);
52
+ shippingMethodId = methods[0].id;
53
+ }
54
+ else {
55
+ shippingMethodId = data.shipping_method;
56
+ }
57
+ const method = await service.retrieveShippingMethod(shippingMethodId, { relations: ["tax_lines", "adjustments"] }, sharedContext);
58
+ const calculatedAmount = (0, utils_1.getShippingMethodsTotals)([method], {})[method.id];
59
+ if (shippingMethodId) {
60
+ actions.push({
61
+ action: utils_2.ChangeActionType.SHIPPING_ADD,
62
+ reference: "order_shipping_method",
63
+ reference_id: shippingMethodId,
64
+ return_id: returnRef.id,
65
+ amount: calculatedAmount.total,
66
+ });
67
+ }
68
+ }
69
+ async function createOrderChange(service, data, returnRef, actions, sharedContext) {
70
+ return await service.createOrderChange_({
71
+ order_id: data.order_id,
72
+ return_id: returnRef.id,
73
+ change_type: _types_1.OrderChangeType.RETURN,
74
+ reference: "return",
75
+ reference_id: returnRef.id,
76
+ description: data.description,
77
+ internal_note: data.internal_note,
78
+ created_by: data.created_by,
79
+ metadata: data.metadata,
80
+ actions,
81
+ }, sharedContext);
82
+ }
83
+ async function createReturn(data, sharedContext) {
84
+ const order = await this.orderService_.retrieve(data.order_id, { relations: ["items"] }, sharedContext);
85
+ const em = sharedContext.transactionManager;
86
+ const returnRef = createReturnReference(em, data, order);
87
+ const actions = [];
88
+ returnRef.items = createReturnItems(em, data, returnRef, actions);
89
+ await processShippingMethod(this, data, returnRef, actions, sharedContext);
90
+ const change = await createOrderChange(this, data, returnRef, actions, sharedContext);
91
+ await (0, utils_1.promiseAll)([
92
+ this.createReturns([returnRef], sharedContext),
93
+ this.confirmOrderChange(change[0].id, sharedContext),
94
+ ]);
95
+ return returnRef;
96
+ }
97
+ exports.createReturn = createReturn;
98
+ //# sourceMappingURL=create-return.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-return.js","sourceRoot":"","sources":["../../../src/services/actions/create-return.ts"],"names":[],"mappings":";;;AAKA,2CAKwB;AACxB,qCAA4C;AAC5C,mCAAwC;AACxC,uCAA8C;AAE9C,SAAS,qBAAqB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK;IAC5C,OAAO,EAAE,CAAC,MAAM,CAAC,gBAAM,EAAE;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,aAAa,EAAE,KAAK,CAAC,OAAO;QAC5B,MAAM,EAAE,oBAAY,CAAC,SAAS;QAC9B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,aAAa,EAAG,IAAI,CAAC,aAAyB,IAAI,IAAI;KACvD,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO;IACrD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7B,OAAO,CAAC,IAAI,CAAC;YACX,MA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EAAE,GAAG,aAAc,CAAC,kBAAyB,CAAA;IACnD,MAAM,SAAS,GAAG,qBAAqB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;IACxD,MAAM,OAAO,GAAiC,EAAE,CAAA;IAChD,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;IACjE,MAAM,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAA;IAC1E,MAAM,MAAM,GAAG,MAAM,iBAAiB,CACpC,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,OAAO,EACP,aAAa,CACd,CAAA;IAED,MAAM,IAAA,kBAAU,EAAC;QACf,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;QAC9C,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC;KACrD,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AAClB,CAAC;AA9BD,oCA8BC"}
@@ -0,0 +1,7 @@
1
+ export * from "./cancel-fulfillment";
2
+ export * from "./create-claim";
3
+ export * from "./create-exchange";
4
+ export * from "./create-return";
5
+ export * from "./receive-return";
6
+ export * from "./register-fulfillment";
7
+ export * from "./register-shipment";
@@ -0,0 +1,24 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./cancel-fulfillment"), exports);
18
+ __exportStar(require("./create-claim"), exports);
19
+ __exportStar(require("./create-exchange"), exports);
20
+ __exportStar(require("./create-return"), exports);
21
+ __exportStar(require("./receive-return"), exports);
22
+ __exportStar(require("./register-fulfillment"), exports);
23
+ __exportStar(require("./register-shipment"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,iDAA8B;AAC9B,oDAAiC;AACjC,kDAA+B;AAC/B,mDAAgC;AAChC,yDAAsC;AACtC,sDAAmC"}
@@ -0,0 +1,2 @@
1
+ import { Context, OrderTypes } from "@medusajs/types";
2
+ export declare function receiveReturn(this: any, data: OrderTypes.ReceiveOrderReturnDTO, sharedContext?: Context): Promise<any>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.receiveReturn = void 0;
4
+ const utils_1 = require("@medusajs/utils");
5
+ const _types_1 = require("../../types");
6
+ const utils_2 = require("../../utils");
7
+ function createReturnItems(data) {
8
+ return data.items.map((item) => ({
9
+ action: utils_2.ChangeActionType.RECEIVE_RETURN_ITEM,
10
+ internal_note: item.internal_note,
11
+ reference: data.reference,
12
+ reference_id: data.reference_id,
13
+ details: {
14
+ reference_id: item.id,
15
+ quantity: item.quantity,
16
+ metadata: item.metadata,
17
+ },
18
+ }));
19
+ }
20
+ async function createOrderChange(service, data, returnEntry, items, sharedContext) {
21
+ return await service.createOrderChange_({
22
+ order_id: returnEntry.order_id,
23
+ return_id: returnEntry.id,
24
+ reference: "return",
25
+ reference_id: returnEntry.id,
26
+ change_type: _types_1.OrderChangeType.RETURN,
27
+ description: data.description,
28
+ internal_note: data.internal_note,
29
+ created_by: data.created_by,
30
+ metadata: data.metadata,
31
+ actions: items,
32
+ }, sharedContext);
33
+ }
34
+ function updateReturnItems(returnEntry, items) {
35
+ return returnEntry.items
36
+ .map((item) => {
37
+ const data = items.find((i) => i.details.reference_id === item.item_id);
38
+ if (!data)
39
+ return;
40
+ const receivedQuantity = utils_1.MathBN.add(item.received_quantity || 0, data.details.quantity);
41
+ item.received_quantity = receivedQuantity;
42
+ return {
43
+ id: item.id,
44
+ received_quantity: receivedQuantity,
45
+ };
46
+ })
47
+ .filter(Boolean);
48
+ }
49
+ function checkAllItemsReceived(returnEntry) {
50
+ return returnEntry.items.every((item) => utils_1.MathBN.eq(item.received_quantity, item.quantity));
51
+ }
52
+ function getReturnUpdateData(hasReceivedAllItems) {
53
+ return hasReceivedAllItems
54
+ ? { status: utils_1.ReturnStatus.RECEIVED, received_at: new Date() }
55
+ : { status: utils_1.ReturnStatus.PARTIALLY_RECEIVED };
56
+ }
57
+ async function receiveReturn(data, sharedContext) {
58
+ const returnEntry = await this.retrieveReturn(data.return_id, {
59
+ select: ["id", "order_id"],
60
+ relations: ["items"],
61
+ }, sharedContext);
62
+ const items = createReturnItems(data);
63
+ const change = await createOrderChange(this, data, returnEntry, items, sharedContext);
64
+ await this.confirmOrderChange(change[0].id, sharedContext);
65
+ const retItemsToUpdate = updateReturnItems(returnEntry, items);
66
+ const hasReceivedAllItems = checkAllItemsReceived(returnEntry);
67
+ const retData = getReturnUpdateData(hasReceivedAllItems);
68
+ const [returnRef] = await (0, utils_1.promiseAll)([
69
+ this.updateReturns({ selector: { id: returnEntry.id }, data: retData }, sharedContext),
70
+ this.updateReturnItems(retItemsToUpdate, sharedContext),
71
+ ]);
72
+ return returnRef;
73
+ }
74
+ exports.receiveReturn = receiveReturn;
75
+ //# sourceMappingURL=receive-return.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receive-return.js","sourceRoot":"","s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J,IAAI,EACJ,WAAW,EACX,KAAK,EACL,aAAa,CACd,CAAA;IAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;IAE1D,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAC9D,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAA;IAC9D,MAAM,OAAO,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAA;IAExD,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,IAAA,kBAAU,EAAC;QACnC,IAAI,CAAC,aAAa,CAChB,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EACnD,aAAa,CACd;QACD,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,aAAa,CAAC;KACxD,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;AAClB,CAAC;AAtCD,sCAsCC"}
@@ -0,0 +1,2 @@
1
+ import { Context, OrderTypes } from "@medusajs/types";
2
+ export declare function registerFulfillment(this: any, data: OrderTypes.RegisterOrderFulfillmentDTO, sharedContext?: Context): Promise<void>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerFulfillment = void 0;
4
+ const utils_1 = require("../../utils");
5
+ async function registerFulfillment(data, sharedContext) {
6
+ const items = data.items.map((item) => {
7
+ return {
8
+ action: utils_1.ChangeActionType.FULFILL_ITEM,
9
+ internal_note: item.internal_note,
10
+ reference: data.reference,
11
+ reference_id: data.reference_id,
12
+ details: {
13
+ reference_id: item.id,
14
+ quantity: item.quantity,
15
+ metadata: item.metadata,
16
+ },
17
+ };
18
+ });
19
+ const change = await this.createOrderChange_({
20
+ order_id: data.order_id,
21
+ description: data.description,
22
+ internal_note: data.internal_note,
23
+ created_by: data.created_by,
24
+ metadata: data.metadata,
25
+ actions: items,
26
+ }, sharedContext);
27
+ await this.confirmOrderChange(change[0].id, sharedContext);
28
+ }
29
+ exports.registerFulfillment = registerFulfillment;
30
+ //# sourceMappingURL=register-fulfillment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-fulfillment.js","sourceRoot":"","sources":["../../../src/services/actions/register-fulfillment.ts"],"names":[],"mappings":";;;AACA,uCAA8C;AAEvC,KAAK,UAAU,mBAAmB,CAEvC,IAA4C,EAC5C,aAAuB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,OAAO;YACL,MAAM,EAAE,wBAAgB,CAAC,YAAY;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI,CAAC,EAAE;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,KAAK;KACf,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;AAC5D,CAAC;AAhCD,kDAgCC"}
@@ -0,0 +1,2 @@
1
+ import { Context, OrderTypes } from "@medusajs/types";
2
+ export declare function registerShipment(this: any, data: OrderTypes.RegisterOrderShipmentDTO, sharedContext?: Context): Promise<void>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerShipment = void 0;
4
+ const utils_1 = require("../../utils");
5
+ async function registerShipment(data, sharedContext) {
6
+ let shippingMethodId;
7
+ const actions = data.items.map((item) => {
8
+ return {
9
+ action: utils_1.ChangeActionType.SHIP_ITEM,
10
+ internal_note: item.internal_note,
11
+ reference: data.reference,
12
+ reference_id: data.reference_id,
13
+ details: {
14
+ reference_id: item.id,
15
+ quantity: item.quantity,
16
+ metadata: item.metadata,
17
+ },
18
+ };
19
+ });
20
+ if (shippingMethodId) {
21
+ actions.push({
22
+ action: utils_1.ChangeActionType.SHIPPING_ADD,
23
+ reference: data.reference,
24
+ reference_id: shippingMethodId,
25
+ });
26
+ }
27
+ const change = await this.createOrderChange_({
28
+ order_id: data.order_id,
29
+ description: data.description,
30
+ internal_note: data.internal_note,
31
+ created_by: data.created_by,
32
+ metadata: data.metadata,
33
+ actions,
34
+ }, sharedContext);
35
+ await this.confirmOrderChange(change[0].id, sharedContext);
36
+ }
37
+ exports.registerShipment = registerShipment;
38
+ //# sourceMappingURL=register-shipment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-shipment.js","sourceRoot":"","sources":["../../../src/services/actions/register-shipment.ts"],"names":[],"mappings":";;;AAKA,uCAA8C;AAEvC,KAAK,UAAU,gBAAgB,CAEpC,IAAyC,EACzC,aAAuB;IAEvB,IAAI,gBAAgB,CAAA;IAEpB,MAAM,OAAO,GAAiC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACpE,OAAO;YACL,MAAM,EAAE,wBAAgB,CAAC,SAAS;YAClC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI,CAAC,EAAE;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB;SACF,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC;YACX,MAAM,EAAE,wBAAgB,CAAC,YAAY;YACrC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,gBAAgB;SAC/B,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAC1C;QACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO;KACR,EACD,aAAa,CACd,CAAA;IAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;AAC5D,CAAC;AA1CD,4CA0CC"}
@@ -3,13 +3,13 @@ import { OrderChange } from "../models";
3
3
  type InjectedDependencies = {
4
4
  orderChangeRepository: DAL.RepositoryService;
5
5
  };
6
- declare const OrderChangeService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => import("@medusajs/types").InternalModuleService<TEntity_1, InjectedDependencies>;
7
- export default class OrderChangeService<TEntity extends OrderChange = OrderChange> extends OrderChangeService_base<TEntity> {
8
- protected readonly orderChangeRepository_: RepositoryService<TEntity>;
6
+ declare const OrderChangeService_base: new <TEntity extends object = any>(container: InjectedDependencies) => import("@medusajs/types").IMedusaInternalService<TEntity, InjectedDependencies>;
7
+ export default class OrderChangeService extends OrderChangeService_base<OrderChange> {
8
+ protected readonly orderChangeRepository_: RepositoryService<OrderChange>;
9
9
  constructor(container: InjectedDependencies);
10
- listCurrentOrderChange<TEntityMethod = OrderTypes.OrderDTO>(orderId: string | string[], config?: FindConfig<TEntityMethod>, sharedContext?: Context): Promise<TEntity[]>;
10
+ listCurrentOrderChange<TEntityMethod = OrderTypes.OrderDTO>(orderId: string | string[], config?: FindConfig<TEntityMethod>, sharedContext?: Context): Promise<OrderChange[]>;
11
11
  isActive(orderChange: OrderChange): boolean;
12
- create(data: Partial<TEntity>[], sharedContext?: Context): Promise<TEntity[]>;
13
- create(data: Partial<TEntity>, sharedContext?: Context): Promise<TEntity>;
12
+ create(data: Partial<OrderChange>[], sharedContext?: Context): Promise<OrderChange[]>;
13
+ create(data: Partial<OrderChange>, sharedContext?: Context): Promise<OrderChange>;
14
14
  }
15
15
  export {};
@@ -14,7 +14,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const utils_1 = require("@medusajs/utils");
16
16
  const _models_1 = require("../models");
17
- class OrderChangeService extends utils_1.ModulesSdkUtils.internalModuleServiceFactory(_models_1.OrderChange) {
17
+ const _types_1 = require("../types");
18
+ class OrderChangeService extends utils_1.ModulesSdkUtils.MedusaInternalService(_models_1.OrderChange) {
18
19
  constructor(container) {
19
20
  // @ts-ignore
20
21
  super(...arguments);
@@ -64,8 +65,8 @@ class OrderChangeService extends utils_1.ModulesSdkUtils.internalModuleServiceFa
64
65
  return await this.orderChangeRepository_.find(queryConfig, sharedContext);
65
66
  }
66
67
  isActive(orderChange) {
67
- return (orderChange.status === utils_1.OrderChangeStatus.PENDING ||
68
- orderChange.status === utils_1.OrderChangeStatus.REQUESTED);
68
+ return (orderChange.status === _types_1.OrderChangeStatus.PENDING ||
69
+ orderChange.status === _types_1.OrderChangeStatus.REQUESTED);
69
70
  }
70
71
  async create(data, sharedContext = {}) {
71
72
  const dataArr = Array.isArray(data) ? data : [data];
@@ -1 +1 @@
1
- {"version":3,"file":"order-change-service.js","sourceRoot":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AAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAS,CAAC,EAC/B,EAAE,EACF,aAAa,CACd,CAAA;QAED,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,mBAAW,CACnB,mBAAW,CAAC,KAAK,CAAC,YAAY,EAC9B,0DAA0D,eAAe;iBACtE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;iBACtB,IAAI,CAAC,GAAG,CAAC,EAAE,CACf,CAAA;QACH,CAAC;QAED,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IACnD,CAAC;CACF;AApHD,qCAoHC;AAtGO;IADL,IAAA,qBAAa,EAAC,wBAAwB,CAAC;IAIrC,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;gEAyDjB;AAoBK;IADL,IAAA,gCAAwB,EAAC,wBAAwB,CAAC;IAGhD,WAAA,IAAA,qBAAa,GAAE,CAAA;;;;gDAmBjB"}
1
+ {"version":3,"file":"order-change-service.js","sourceRoot":"","sources":["../../src/services/order-change-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAOA,2CAOwB;AACxB,qCAAqC;AACrC,mCAA0C;AAM1C,MAAqB,kBAAmB,SAAQ,uBAAe,CAAC,qBAAqB,CACnF,qBAAW,CACC;IAGZ,YAAY,SAA+B;QACzC,aAAa;QACb,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QACnB,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC,qBAAqB,CAAA;IAC/D,CAAC;IAGK,AAAN,KAAK,CAAC,sBAAsB,CAC1B,OAA0B,EAC1B,SAAoC,EAAE,EACrB,gBAAyB,EAAE;QAE5C,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,IAAI,CACjC,EAAE,QAAQ,EAAE,OAAO,EAAE,EACrB,MAAM,IAAI;YACR,MAAM,EAAE,C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