@vendure/core 3.7.4-master-202610050222 → 3.7.4
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/config/catalog/default-stock-location-strategy.d.ts +57 -2
- package/dist/config/catalog/default-stock-location-strategy.js +101 -5
- package/dist/config/catalog/default-stock-location-strategy.js.map +1 -1
- package/dist/config/catalog/multi-channel-stock-location-strategy.d.ts +0 -5
- package/dist/config/catalog/multi-channel-stock-location-strategy.js +13 -27
- package/dist/config/catalog/multi-channel-stock-location-strategy.js.map +1 -1
- package/dist/config/order/default-order-process.js +13 -1
- package/dist/config/order/default-order-process.js.map +1 -1
- package/dist/config/order/stock-allocation-strategy.d.ts +4 -0
- package/dist/entity/order-line/order-line.entity.d.ts +3 -29
- package/dist/entity/order-line/order-line.entity.js +20 -66
- package/dist/entity/order-line/order-line.entity.js.map +1 -1
- package/dist/event-bus/events/stock-shortfall-event.d.ts +40 -0
- package/dist/event-bus/events/stock-shortfall-event.js +29 -0
- package/dist/event-bus/events/stock-shortfall-event.js.map +1 -0
- package/dist/event-bus/index.d.ts +1 -0
- package/dist/event-bus/index.js +1 -0
- package/dist/event-bus/index.js.map +1 -1
- package/dist/migration-utils/index.d.ts +0 -1
- package/dist/migration-utils/index.js +1 -3
- package/dist/migration-utils/index.js.map +1 -1
- package/dist/service/helpers/order-modifier/order-modifier.d.ts +15 -2
- package/dist/service/helpers/order-modifier/order-modifier.js +37 -12
- package/dist/service/helpers/order-modifier/order-modifier.js.map +1 -1
- package/dist/service/helpers/utils/stock-lock-order.d.ts +11 -0
- package/dist/service/helpers/utils/stock-lock-order.js +22 -0
- package/dist/service/helpers/utils/stock-lock-order.js.map +1 -0
- package/dist/service/services/product-variant.service.d.ts +9 -2
- package/dist/service/services/product-variant.service.js +18 -2
- package/dist/service/services/product-variant.service.js.map +1 -1
- package/dist/service/services/stock-level.service.d.ts +124 -2
- package/dist/service/services/stock-level.service.js +181 -12
- package/dist/service/services/stock-level.service.js.map +1 -1
- package/dist/service/services/stock-movement.service.d.ts +9 -0
- package/dist/service/services/stock-movement.service.js +143 -50
- package/dist/service/services/stock-movement.service.js.map +1 -1
- package/package.json +2 -2
- package/dist/migration-utils/v3_8_orderline_promotion_rescale.d.ts +0 -57
- package/dist/migration-utils/v3_8_orderline_promotion_rescale.js +0 -232
- package/dist/migration-utils/v3_8_orderline_promotion_rescale.js.map +0 -1
|
@@ -22,8 +22,8 @@ const channel_entity_1 = require("../channel/channel.entity");
|
|
|
22
22
|
const custom_entity_fields_1 = require("../custom-entity-fields");
|
|
23
23
|
const entity_id_decorator_1 = require("../entity-id.decorator");
|
|
24
24
|
const money_decorator_1 = require("../money.decorator");
|
|
25
|
-
const order_line_reference_entity_1 = require("../order-line-reference/order-line-reference.entity");
|
|
26
25
|
const order_entity_1 = require("../order/order.entity");
|
|
26
|
+
const order_line_reference_entity_1 = require("../order-line-reference/order-line-reference.entity");
|
|
27
27
|
const product_variant_entity_1 = require("../product-variant/product-variant.entity");
|
|
28
28
|
const shipping_line_entity_1 = require("../shipping-line/shipping-line.entity");
|
|
29
29
|
const allocation_entity_1 = require("../stock-movement/allocation.entity");
|
|
@@ -155,21 +155,18 @@ let OrderLine = class OrderLine extends base_entity_1.VendureEntity {
|
|
|
155
155
|
// Group discounts together, so that it does not list a new
|
|
156
156
|
// discount row for each item in the line
|
|
157
157
|
const groupedDiscounts = new Map();
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
// regardless of what the stored adjustment amount is.
|
|
158
|
+
// A line added by an OrderModification keeps an orderPlacedQuantity of 0, so once it is
|
|
159
|
+
// cancelled there are no units left to prorate the adjustment over.
|
|
160
|
+
const proratedOverQuantity = Math.max(this.orderPlacedQuantity, this.quantity);
|
|
162
161
|
for (const adjustment of this.adjustments) {
|
|
163
162
|
const discountGroup = groupedDiscounts.get(adjustment.adjustmentSource);
|
|
164
|
-
const
|
|
165
|
-
? 0
|
|
166
|
-
: (adjustment.amount / this.quantityBasisFor(adjustment)) * this.quantity;
|
|
163
|
+
const unitAdjustmentAmount = proratedOverQuantity === 0 ? 0 : (adjustment.amount / proratedOverQuantity) * this.quantity;
|
|
167
164
|
const amount = priceIncludesTax
|
|
168
|
-
? (0, tax_utils_1.netPriceOf)(
|
|
169
|
-
:
|
|
165
|
+
? (0, tax_utils_1.netPriceOf)(unitAdjustmentAmount, this.taxRate)
|
|
166
|
+
: unitAdjustmentAmount;
|
|
170
167
|
const amountWithTax = priceIncludesTax
|
|
171
|
-
?
|
|
172
|
-
: (0, tax_utils_1.grossPriceOf)(
|
|
168
|
+
? unitAdjustmentAmount
|
|
169
|
+
: (0, tax_utils_1.grossPriceOf)(unitAdjustmentAmount, this.taxRate);
|
|
173
170
|
if (discountGroup) {
|
|
174
171
|
discountGroup.amount += amount;
|
|
175
172
|
discountGroup.amountWithTax += amountWithTax;
|
|
@@ -217,26 +214,6 @@ let OrderLine = class OrderLine extends base_entity_1.VendureEntity {
|
|
|
217
214
|
this.adjustments = this.adjustments.concat(limitedAdjustment);
|
|
218
215
|
}
|
|
219
216
|
}
|
|
220
|
-
/**
|
|
221
|
-
* @description
|
|
222
|
-
* Sets this line's quantity to `newQuantity`, rescaling its `PROMOTION`-type adjustments to
|
|
223
|
-
* match. Used where a quantity reduction bypasses `OrderCalculator` recalculation (see
|
|
224
|
-
* `OrderModifier.cancelOrderByOrderLines()`), to preserve the invariant that `PROMOTION`
|
|
225
|
-
* amounts are stored scaled to the current quantity.
|
|
226
|
-
*
|
|
227
|
-
* A `newQuantity` of 0 sets the quantity but leaves the adjustments untouched: the getters
|
|
228
|
-
* short-circuit on an empty line either way, so scaling them to zero would only erase the
|
|
229
|
-
* record of the discount that had applied, which plugins and accounting exports read back.
|
|
230
|
-
*/
|
|
231
|
-
setQuantityRescalingAdjustments(newQuantity) {
|
|
232
|
-
var _a;
|
|
233
|
-
if (0 < newQuantity) {
|
|
234
|
-
const scaleFactor = newQuantity / this.quantity;
|
|
235
|
-
this.adjustments = ((_a = this.adjustments) !== null && _a !== void 0 ? _a : []).map(adjustment => adjustment.type === generated_types_1.AdjustmentType.PROMOTION
|
|
236
|
-
? Object.assign(Object.assign({}, adjustment), { amount: (0, round_money_1.roundMoney)(adjustment.amount * scaleFactor) }) : adjustment);
|
|
237
|
-
}
|
|
238
|
-
this.quantity = newQuantity;
|
|
239
|
-
}
|
|
240
217
|
/**
|
|
241
218
|
* Clears Adjustments from all OrderItems of the given type. If no type
|
|
242
219
|
* is specified, then all adjustments are removed.
|
|
@@ -285,9 +262,7 @@ let OrderLine = class OrderLine extends base_entity_1.VendureEntity {
|
|
|
285
262
|
}
|
|
286
263
|
/**
|
|
287
264
|
* @description
|
|
288
|
-
* The total of all price adjustments
|
|
289
|
-
* number due to discounts. See `quantityBasisFor()` for the quantity basis used per
|
|
290
|
-
* adjustment, which differs by `AdjustmentType`.
|
|
265
|
+
* The total of all price adjustments. Will typically be a negative number due to discounts.
|
|
291
266
|
*/
|
|
292
267
|
getUnitAdjustmentsTotal(type) {
|
|
293
268
|
if (!this.adjustments || this.quantity === 0) {
|
|
@@ -295,13 +270,12 @@ let OrderLine = class OrderLine extends base_entity_1.VendureEntity {
|
|
|
295
270
|
}
|
|
296
271
|
return this.adjustments
|
|
297
272
|
.filter(adjustment => (type ? adjustment.type === type : true))
|
|
298
|
-
.map(adjustment => adjustment.amount / this.
|
|
273
|
+
.map(adjustment => adjustment.amount / Math.max(this.orderPlacedQuantity, this.quantity))
|
|
299
274
|
.reduce((total, a) => total + a, 0);
|
|
300
275
|
}
|
|
301
276
|
/**
|
|
302
277
|
* @description
|
|
303
|
-
* The total of all price adjustments
|
|
304
|
-
* due to discounts. See `quantityBasisFor()` for the quantity basis used per adjustment.
|
|
278
|
+
* The total of all price adjustments. Will typically be a negative number due to discounts.
|
|
305
279
|
*/
|
|
306
280
|
getLineAdjustmentsTotal(withTax, type) {
|
|
307
281
|
if (!this.adjustments || this.quantity === 0) {
|
|
@@ -309,40 +283,20 @@ let OrderLine = class OrderLine extends base_entity_1.VendureEntity {
|
|
|
309
283
|
}
|
|
310
284
|
const sum = this.adjustments
|
|
311
285
|
.filter(adjustment => (type ? adjustment.type === type : true))
|
|
312
|
-
.map(adjustment =>
|
|
286
|
+
.map(adjustment => adjustment.amount)
|
|
313
287
|
.reduce((total, a) => total + a, 0);
|
|
288
|
+
const adjustedForQuantityChanges = sum * (this.quantity / Math.max(this.orderPlacedQuantity, this.quantity));
|
|
314
289
|
if (withTax) {
|
|
315
|
-
return this.listPriceIncludesTax
|
|
290
|
+
return this.listPriceIncludesTax
|
|
291
|
+
? adjustedForQuantityChanges
|
|
292
|
+
: (0, tax_utils_1.grossPriceOf)(adjustedForQuantityChanges, this.taxRate);
|
|
316
293
|
}
|
|
317
294
|
else {
|
|
318
|
-
return this.listPriceIncludesTax
|
|
295
|
+
return this.listPriceIncludesTax
|
|
296
|
+
? (0, tax_utils_1.netPriceOf)(adjustedForQuantityChanges, this.taxRate)
|
|
297
|
+
: adjustedForQuantityChanges;
|
|
319
298
|
}
|
|
320
299
|
}
|
|
321
|
-
/**
|
|
322
|
-
* @description
|
|
323
|
-
* The quantity that `adjustment.amount` (a line total) should be divided by to get a correct
|
|
324
|
-
* per-unit share. `PROMOTION` adjustments are always freshly recomputed against the current
|
|
325
|
-
* `this.quantity`, so that is their basis. Other types (`DISTRIBUTED_ORDER_PROMOTION`, `OTHER`)
|
|
326
|
-
* are a per-line share of an order-level amount that is redistributed by weight on every
|
|
327
|
-
* recalculation, so their basis is pinned to `orderPlacedQuantity` - otherwise a partially
|
|
328
|
-
* cancelled/refunded line's surviving units could absorb a bigger share than they're due. See
|
|
329
|
-
* #5127 for the full reasoning.
|
|
330
|
-
*/
|
|
331
|
-
quantityBasisFor(adjustment) {
|
|
332
|
-
const basis = (() => {
|
|
333
|
-
switch (adjustment.type) {
|
|
334
|
-
case generated_types_1.AdjustmentType.PROMOTION:
|
|
335
|
-
return this.quantity;
|
|
336
|
-
case generated_types_1.AdjustmentType.DISTRIBUTED_ORDER_PROMOTION:
|
|
337
|
-
case generated_types_1.AdjustmentType.OTHER:
|
|
338
|
-
default:
|
|
339
|
-
return Math.max(this.orderPlacedQuantity, this.quantity);
|
|
340
|
-
}
|
|
341
|
-
})();
|
|
342
|
-
// An empty line has no units to divide across; every caller discards the result in that
|
|
343
|
-
// case, and 1 keeps a future caller that forgets from producing NaN (cf. #5101).
|
|
344
|
-
return basis === 0 ? 1 : basis;
|
|
345
|
-
}
|
|
346
300
|
};
|
|
347
301
|
exports.OrderLine = OrderLine;
|
|
348
302
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-line.entity.js","sourceRoot":"","sources":["../../../src/entity/order-line/order-line.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAoG;AAEpG,mEAA2D;AAC3D,qCAAsE;AAEtE,4EAA+D;AAC/D,0DAAsD;AACtD,sDAAkE;AAElE,wDAA8C;AAC9C,qDAAoD;AACpD,8DAAoD;AACpD,kEAAgE;AAChE,gEAAkD;AAClD,wDAA2C;AAC3C,qGAAyF;AACzF,wDAA8C;AAC9C,sFAA2E;AAC3E,gFAAqE;AACrE,2EAAiE;AACjE,+EAAqE;AACrE,+DAAqD;AACrD,6EAAkE;AAElE;;;;;;GAMG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,2BAAa;IACxC,YAAY,KAA8B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IA6GD;;;OAGG;IACH,IACI,SAAS;QACT,OAAO,IAAA,wBAAU,EAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,IACI,gBAAgB;QAChB,OAAO,IAAA,wBAAU,EAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACH,IACI,yBAAyB;QACzB,MAAM,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,GAAG,I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MD;IAAC,IAAA,iCAAU,GAAE;;;yDAIZ;AAED;IAAC,IAAA,iCAAU,GAAE;;;gDAGZ;oBA9TQ,SAAS;IADrB,IAAA,gBAAM,GAAE;;GACI,SAAS,CAwarB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ID } from '@vendure/common/lib/shared-types';
|
|
2
|
+
import { RequestContext } from '../../api/common/request-context';
|
|
3
|
+
import { Order } from '../../entity/order/order.entity';
|
|
4
|
+
import { VendureEvent } from '../vendure-event';
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* Describes a single order line whose requested quantity could not be fully allocated
|
|
8
|
+
* from available stock.
|
|
9
|
+
*
|
|
10
|
+
* @since 3.7.4
|
|
11
|
+
* @docsCategory events
|
|
12
|
+
* @docsPage Event Types
|
|
13
|
+
*/
|
|
14
|
+
export interface StockShortfall {
|
|
15
|
+
productVariantId: ID;
|
|
16
|
+
orderLineId: ID;
|
|
17
|
+
requested: number;
|
|
18
|
+
allocated: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @description
|
|
22
|
+
* This event is fired when stock allocation for an Order cannot fully satisfy the requested
|
|
23
|
+
* quantities — i.e. the available stock was depleted (e.g. by concurrent orders) between the time
|
|
24
|
+
* the cart passed the checkout stock check and the time stock was actually allocated. Because the
|
|
25
|
+
* payment may already have been captured, allocation is capped to the available quantity rather than
|
|
26
|
+
* failing, and this event is published so that plugins can react (refund, backorder, notify).
|
|
27
|
+
*
|
|
28
|
+
* The `order` carries only its own columns: no relations (lines, customer, payments) are loaded.
|
|
29
|
+
* Fetch them via the {@link OrderService} if needed.
|
|
30
|
+
*
|
|
31
|
+
* @since 3.7.4
|
|
32
|
+
* @docsCategory events
|
|
33
|
+
* @docsPage Event Types
|
|
34
|
+
*/
|
|
35
|
+
export declare class StockShortfallEvent extends VendureEvent {
|
|
36
|
+
ctx: RequestContext;
|
|
37
|
+
order: Order;
|
|
38
|
+
shortfalls: StockShortfall[];
|
|
39
|
+
constructor(ctx: RequestContext, order: Order, shortfalls: StockShortfall[]);
|
|
40
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StockShortfallEvent = void 0;
|
|
4
|
+
const vendure_event_1 = require("../vendure-event");
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* This event is fired when stock allocation for an Order cannot fully satisfy the requested
|
|
8
|
+
* quantities — i.e. the available stock was depleted (e.g. by concurrent orders) between the time
|
|
9
|
+
* the cart passed the checkout stock check and the time stock was actually allocated. Because the
|
|
10
|
+
* payment may already have been captured, allocation is capped to the available quantity rather than
|
|
11
|
+
* failing, and this event is published so that plugins can react (refund, backorder, notify).
|
|
12
|
+
*
|
|
13
|
+
* The `order` carries only its own columns: no relations (lines, customer, payments) are loaded.
|
|
14
|
+
* Fetch them via the {@link OrderService} if needed.
|
|
15
|
+
*
|
|
16
|
+
* @since 3.7.4
|
|
17
|
+
* @docsCategory events
|
|
18
|
+
* @docsPage Event Types
|
|
19
|
+
*/
|
|
20
|
+
class StockShortfallEvent extends vendure_event_1.VendureEvent {
|
|
21
|
+
constructor(ctx, order, shortfalls) {
|
|
22
|
+
super();
|
|
23
|
+
this.ctx = ctx;
|
|
24
|
+
this.order = order;
|
|
25
|
+
this.shortfalls = shortfalls;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.StockShortfallEvent = StockShortfallEvent;
|
|
29
|
+
//# sourceMappingURL=stock-shortfall-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-shortfall-event.js","sourceRoot":"","sources":["../../../src/event-bus/events/stock-shortfall-event.ts"],"names":[],"mappings":";;;AAIA,oDAAgD;AAkBhD;;;;;;;;;;;;;;GAcG;AACH,MAAa,mBAAoB,SAAQ,4BAAY;IACjD,YACW,GAAmB,EACnB,KAAY,EACZ,UAA4B;QAEnC,KAAK,EAAE,CAAC;QAJD,QAAG,GAAH,GAAG,CAAgB;QACnB,UAAK,GAAL,KAAK,CAAO;QACZ,eAAU,GAAV,UAAU,CAAkB;IAGvC,CAAC;CACJ;AARD,kDAQC"}
|
|
@@ -58,6 +58,7 @@ export * from './events/seller-event';
|
|
|
58
58
|
export * from './events/shipping-method-event';
|
|
59
59
|
export * from './events/stock-location-event';
|
|
60
60
|
export * from './events/stock-movement-event';
|
|
61
|
+
export * from './events/stock-shortfall-event';
|
|
61
62
|
export * from './events/tax-category-event';
|
|
62
63
|
export * from './events/tax-rate-event';
|
|
63
64
|
export * from './events/tax-rate-modification-event';
|
package/dist/event-bus/index.js
CHANGED
|
@@ -74,6 +74,7 @@ __exportStar(require("./events/seller-event"), exports);
|
|
|
74
74
|
__exportStar(require("./events/shipping-method-event"), exports);
|
|
75
75
|
__exportStar(require("./events/stock-location-event"), exports);
|
|
76
76
|
__exportStar(require("./events/stock-movement-event"), exports);
|
|
77
|
+
__exportStar(require("./events/stock-shortfall-event"), exports);
|
|
77
78
|
__exportStar(require("./events/tax-category-event"), exports);
|
|
78
79
|
__exportStar(require("./events/tax-rate-event"), exports);
|
|
79
80
|
__exportStar(require("./events/tax-rate-modification-event"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/event-bus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,qDAAmC;AACnC,yDAAuC;AACvC,kDAAgC;AAEhC,sEAAoD;AACpD,kEAAgD;AAChD,+DAA6C;AAC7C,yDAAuC;AACvC,+DAA6C;AAC7C,uDAAqC;AACrC,iEAA+C;AAC/C,8DAA4C;AAC5C,gEAA8C;AAC9C,yDAAuC;AACvC,4DAA0C;AAC1C,yEAAuD;AACvD,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAChD,0DAAwC;AACxC,uEAAqD;AACrD,gEAA8C;AAC9C,uDAAqC;AACrC,6D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,4DAA0C;AAC1C,8DAA4C;AAC5C,wEAAsD;AACtD,gEAA8C;AAC9C,yEAAuD;AACvD,gEAA8C;AAC9C,0EAAwD;AACxD,iEAA+C;AAC/C,yDAAuC;AACvC,gEAA8C;AAC9C,6EAA2D;AAC3D,sEAAoD;AACpD,yEAAuD;AACvD,iEAA+C;AAC/C,uEAAqD;AACrD,2DAAyC;AACzC,0DAAwC;AACxC,wDAAsC;AACtC,yEAAuD;AACvD,6DAA2C;AAC3C,sDAAoC;AACpC,wDAAsC;AACtC,wDAAsC;AACtC,iEAA+C;AAC/C,gEAA8C;AAC9C,gEAA8C;AAC9C,iEAA+C;AAC/C,8DAA4C;AAC5C,0DAAwC;AACxC,uEAAqD;AACrD,sDAAoC;AACpC,8DAA4C"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { migrateAssetTranslationData } from './v3_6_asset_translations';
|
|
2
2
|
export { migrateProductOptionGroupData } from './v3_6_shared_option_groups';
|
|
3
|
-
export { RescaleOrderLinePromotionAdjustmentsOptions, rescaleOrderLinePromotionAdjustments, } from './v3_8_orderline_promotion_rescale';
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.migrateProductOptionGroupData = exports.migrateAssetTranslationData = void 0;
|
|
4
4
|
var v3_6_asset_translations_1 = require("./v3_6_asset_translations");
|
|
5
5
|
Object.defineProperty(exports, "migrateAssetTranslationData", { enumerable: true, get: function () { return v3_6_asset_translations_1.migrateAssetTranslationData; } });
|
|
6
6
|
var v3_6_shared_option_groups_1 = require("./v3_6_shared_option_groups");
|
|
7
7
|
Object.defineProperty(exports, "migrateProductOptionGroupData", { enumerable: true, get: function () { return v3_6_shared_option_groups_1.migrateProductOptionGroupData; } });
|
|
8
|
-
var v3_8_orderline_promotion_rescale_1 = require("./v3_8_orderline_promotion_rescale");
|
|
9
|
-
Object.defineProperty(exports, "rescaleOrderLinePromotionAdjustments", { enumerable: true, get: function () { return v3_8_orderline_promotion_rescale_1.rescaleOrderLinePromotionAdjustments; } });
|
|
10
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration-utils/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAA/D,sIAAA,2BAA2B,OAAA;AACpC,yEAA4E;AAAnE,0IAAA,6BAA6B,OAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration-utils/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AAA/D,sIAAA,2BAA2B,OAAA;AACpC,yEAA4E;AAAnE,0IAAA,6BAA6B,OAAA"}
|
|
@@ -16,6 +16,7 @@ import { HistoryService } from '../../services/history.service';
|
|
|
16
16
|
import { PaymentService } from '../../services/payment.service';
|
|
17
17
|
import { ProductVariantService } from '../../services/product-variant.service';
|
|
18
18
|
import { PromotionService } from '../../services/promotion.service';
|
|
19
|
+
import { StockLevelReadOptions, StockLevelService } from '../../services/stock-level.service';
|
|
19
20
|
import { StockMovementService } from '../../services/stock-movement.service';
|
|
20
21
|
import { CustomFieldRelationService } from '../custom-field-relation/custom-field-relation.service';
|
|
21
22
|
import { OrderCalculator } from '../order-calculator/order-calculator';
|
|
@@ -48,7 +49,8 @@ export declare class OrderModifier {
|
|
|
48
49
|
private shippingCalculator;
|
|
49
50
|
private historyService;
|
|
50
51
|
private translator;
|
|
51
|
-
|
|
52
|
+
private stockLevelService;
|
|
53
|
+
constructor(connection: TransactionalConnection, configService: ConfigService, orderCalculator: OrderCalculator, paymentService: PaymentService, countryService: CountryService, stockMovementService: StockMovementService, productVariantService: ProductVariantService, customFieldRelationService: CustomFieldRelationService, promotionService: PromotionService, eventBus: EventBus, shippingCalculator: ShippingCalculator, historyService: HistoryService, translator: TranslatorService, stockLevelService: StockLevelService);
|
|
52
54
|
/**
|
|
53
55
|
* @description
|
|
54
56
|
* Ensure that the ProductVariant has sufficient saleable stock to add the given
|
|
@@ -61,8 +63,13 @@ export declare class OrderModifier {
|
|
|
61
63
|
* have differing values for one or more custom fields. In this case, we need to take _all_ of these
|
|
62
64
|
* OrderLines into account when constraining the quantity. See https://github.com/vendurehq/vendure/issues/2702
|
|
63
65
|
* for more on this.
|
|
66
|
+
* - `options.lockStockLevels` must be `true` when the caller allocates stock in the same
|
|
67
|
+
* transaction based on the result, so that the check and the allocation cannot be interleaved
|
|
68
|
+
* with another transaction for the same ProductVariant. See {@link StockLevelService.getAvailableStock}.
|
|
69
|
+
*
|
|
70
|
+
* @since 3.7.4 - Added the `options` parameter
|
|
64
71
|
*/
|
|
65
|
-
constrainQuantityToSaleable(ctx: RequestContext, variant: ProductVariant, quantity: number, existingOrderLineQuantity?: number, quantityInOtherOrderLines?: number): Promise<number>;
|
|
72
|
+
constrainQuantityToSaleable(ctx: RequestContext, variant: ProductVariant, quantity: number, existingOrderLineQuantity?: number, quantityInOtherOrderLines?: number, options?: StockLevelReadOptions): Promise<number>;
|
|
66
73
|
/**
|
|
67
74
|
* @description
|
|
68
75
|
* Given a ProductVariant ID and optional custom fields, this method will return an existing OrderLine that
|
|
@@ -112,4 +119,10 @@ export declare class OrderModifier {
|
|
|
112
119
|
*/
|
|
113
120
|
private coerceValue;
|
|
114
121
|
private getProductVariantOrThrow;
|
|
122
|
+
/**
|
|
123
|
+
* modifyOrder allocates, releases and cancels stock in one transaction, visiting the lines in
|
|
124
|
+
* the caller's order. Locking every affected variant up front, in the shared order, means it
|
|
125
|
+
* cannot deadlock with a concurrent modification or settlement.
|
|
126
|
+
*/
|
|
127
|
+
private lockStockLevelsForModification;
|
|
115
128
|
}
|
|
@@ -43,6 +43,7 @@ const history_service_1 = require("../../services/history.service");
|
|
|
43
43
|
const payment_service_1 = require("../../services/payment.service");
|
|
44
44
|
const product_variant_service_1 = require("../../services/product-variant.service");
|
|
45
45
|
const promotion_service_1 = require("../../services/promotion.service");
|
|
46
|
+
const stock_level_service_1 = require("../../services/stock-level.service");
|
|
46
47
|
const stock_movement_service_1 = require("../../services/stock-movement.service");
|
|
47
48
|
const custom_field_relation_service_1 = require("../custom-field-relation/custom-field-relation.service");
|
|
48
49
|
const order_calculator_1 = require("../order-calculator/order-calculator");
|
|
@@ -65,7 +66,7 @@ const patch_entity_1 = require("../utils/patch-entity");
|
|
|
65
66
|
* @docsCategory service-helpers
|
|
66
67
|
*/
|
|
67
68
|
let OrderModifier = class OrderModifier {
|
|
68
|
-
constructor(connection, configService, orderCalculator, paymentService, countryService, stockMovementService, productVariantService, customFieldRelationService, promotionService, eventBus, shippingCalculator, historyService, translator) {
|
|
69
|
+
constructor(connection, configService, orderCalculator, paymentService, countryService, stockMovementService, productVariantService, customFieldRelationService, promotionService, eventBus, shippingCalculator, historyService, translator, stockLevelService) {
|
|
69
70
|
this.connection = connection;
|
|
70
71
|
this.configService = configService;
|
|
71
72
|
this.orderCalculator = orderCalculator;
|
|
@@ -79,6 +80,7 @@ let OrderModifier = class OrderModifier {
|
|
|
79
80
|
this.shippingCalculator = shippingCalculator;
|
|
80
81
|
this.historyService = historyService;
|
|
81
82
|
this.translator = translator;
|
|
83
|
+
this.stockLevelService = stockLevelService;
|
|
82
84
|
}
|
|
83
85
|
/**
|
|
84
86
|
* @description
|
|
@@ -92,10 +94,15 @@ let OrderModifier = class OrderModifier {
|
|
|
92
94
|
* have differing values for one or more custom fields. In this case, we need to take _all_ of these
|
|
93
95
|
* OrderLines into account when constraining the quantity. See https://github.com/vendurehq/vendure/issues/2702
|
|
94
96
|
* for more on this.
|
|
97
|
+
* - `options.lockStockLevels` must be `true` when the caller allocates stock in the same
|
|
98
|
+
* transaction based on the result, so that the check and the allocation cannot be interleaved
|
|
99
|
+
* with another transaction for the same ProductVariant. See {@link StockLevelService.getAvailableStock}.
|
|
100
|
+
*
|
|
101
|
+
* @since 3.7.4 - Added the `options` parameter
|
|
95
102
|
*/
|
|
96
|
-
async constrainQuantityToSaleable(ctx, variant, quantity, existingOrderLineQuantity = 0, quantityInOtherOrderLines = 0) {
|
|
103
|
+
async constrainQuantityToSaleable(ctx, variant, quantity, existingOrderLineQuantity = 0, quantityInOtherOrderLines = 0, options) {
|
|
97
104
|
let correctedQuantity = quantity + existingOrderLineQuantity;
|
|
98
|
-
const saleableStockLevel = await this.productVariantService.getSaleableStockLevel(ctx, variant);
|
|
105
|
+
const saleableStockLevel = await this.productVariantService.getSaleableStockLevel(ctx, variant, options);
|
|
99
106
|
if (saleableStockLevel < correctedQuantity + quantityInOtherOrderLines) {
|
|
100
107
|
correctedQuantity = Math.max(saleableStockLevel - existingOrderLineQuantity - quantityInOtherOrderLines, 0);
|
|
101
108
|
}
|
|
@@ -270,18 +277,18 @@ let OrderModifier = class OrderModifier {
|
|
|
270
277
|
});
|
|
271
278
|
}
|
|
272
279
|
}
|
|
280
|
+
// Cancellations and releases touch different sets of variants, so lock their union once,
|
|
281
|
+
// in the shared order, rather than letting each call lock its own set.
|
|
282
|
+
await this.stockLevelService.lockStockLevelsForVariants(ctx, [...fulfilledLines, ...allocatedLines]
|
|
283
|
+
.map(line => { var _a; return (_a = fullOrder.lines.find(l => (0, utils_1.idsAreEqual)(l.id, line.orderLineId))) === null || _a === void 0 ? void 0 : _a.productVariantId; })
|
|
284
|
+
.filter((id) => id != null));
|
|
273
285
|
await this.stockMovementService.createCancellationsForOrderLines(ctx, fulfilledLines);
|
|
274
286
|
await this.stockMovementService.createReleasesForOrderLines(ctx, allocatedLines);
|
|
275
287
|
for (const line of lineInputs) {
|
|
276
288
|
const orderLine = fullOrder.lines.find(l => (0, utils_1.idsAreEqual)(l.id, line.orderLineId));
|
|
277
289
|
if (orderLine) {
|
|
278
|
-
// A partial cancellation bypasses `OrderCalculator` recalculation entirely, so the
|
|
279
|
-
// `PROMOTION` adjustments are rescaled here to preserve the invariant that they are
|
|
280
|
-
// stored scaled to the current quantity.
|
|
281
|
-
orderLine.setQuantityRescalingAdjustments(orderLine.quantity - line.quantity);
|
|
282
290
|
await this.connection.getRepository(ctx, order_line_entity_1.OrderLine).update(line.orderLineId, {
|
|
283
|
-
quantity: orderLine.quantity,
|
|
284
|
-
adjustments: orderLine.adjustments,
|
|
291
|
+
quantity: orderLine.quantity - line.quantity,
|
|
285
292
|
});
|
|
286
293
|
await this.eventBus.publish(new order_line_event_1.OrderLineEvent(ctx, order, orderLine, 'cancelled'));
|
|
287
294
|
}
|
|
@@ -351,6 +358,7 @@ let OrderModifier = class OrderModifier {
|
|
|
351
358
|
amount: refund.amount,
|
|
352
359
|
reason: refund.reason || input.note,
|
|
353
360
|
}));
|
|
361
|
+
await this.lockStockLevelsForModification(ctx, order, input);
|
|
354
362
|
for (const row of (_a = input.addItems) !== null && _a !== void 0 ? _a : []) {
|
|
355
363
|
const { productVariantId, quantity } = row;
|
|
356
364
|
if (quantity < 0) {
|
|
@@ -358,7 +366,9 @@ let OrderModifier = class OrderModifier {
|
|
|
358
366
|
}
|
|
359
367
|
const customFields = row.customFields || {};
|
|
360
368
|
const orderLine = await this.getOrCreateOrderLine(ctx, order, productVariantId, customFields);
|
|
361
|
-
|
|
369
|
+
// The allocation in updateOrderLineQuantity runs in this transaction, so the check
|
|
370
|
+
// re-reads the rows locked by lockStockLevelsForModification() above.
|
|
371
|
+
const correctedQuantity = await this.constrainQuantityToSaleable(ctx, orderLine.productVariant, quantity, 0, 0, { lockStockLevels: true });
|
|
362
372
|
if (orderItemsLimit < currentItemsCount + correctedQuantity) {
|
|
363
373
|
return new generated_graphql_shop_errors_1.OrderLimitError({ maxItems: orderItemsLimit });
|
|
364
374
|
}
|
|
@@ -388,7 +398,8 @@ let OrderModifier = class OrderModifier {
|
|
|
388
398
|
const initialLineQuantity = orderLine.quantity;
|
|
389
399
|
let correctedQuantity = quantity;
|
|
390
400
|
if (initialLineQuantity < quantity) {
|
|
391
|
-
|
|
401
|
+
// See the comment on the addItems loop above.
|
|
402
|
+
const additionalQuantity = await this.constrainQuantityToSaleable(ctx, orderLine.productVariant, quantity - initialLineQuantity, 0, 0, { lockStockLevels: true });
|
|
392
403
|
correctedQuantity = initialLineQuantity + additionalQuantity;
|
|
393
404
|
}
|
|
394
405
|
const resultingOrderTotalQuantity = currentItemsCount + correctedQuantity - orderLine.quantity;
|
|
@@ -776,6 +787,19 @@ let OrderModifier = class OrderModifier {
|
|
|
776
787
|
throw new errors_1.EntityNotFoundError('ProductVariant', productVariantId);
|
|
777
788
|
}
|
|
778
789
|
}
|
|
790
|
+
/**
|
|
791
|
+
* modifyOrder allocates, releases and cancels stock in one transaction, visiting the lines in
|
|
792
|
+
* the caller's order. Locking every affected variant up front, in the shared order, means it
|
|
793
|
+
* cannot deadlock with a concurrent modification or settlement.
|
|
794
|
+
*/
|
|
795
|
+
async lockStockLevelsForModification(ctx, order, input) {
|
|
796
|
+
var _a, _b;
|
|
797
|
+
const variantIds = [
|
|
798
|
+
...((_a = input.addItems) !== null && _a !== void 0 ? _a : []).map(row => row.productVariantId),
|
|
799
|
+
...((_b = input.adjustOrderLines) !== null && _b !== void 0 ? _b : []).map(row => { var _a; return (_a = order.lines.find(line => (0, utils_1.idsAreEqual)(line.id, row.orderLineId))) === null || _a === void 0 ? void 0 : _a.productVariantId; }),
|
|
800
|
+
].filter((id) => id != null);
|
|
801
|
+
await this.stockLevelService.lockStockLevelsForVariants(ctx, variantIds);
|
|
802
|
+
}
|
|
779
803
|
};
|
|
780
804
|
exports.OrderModifier = OrderModifier;
|
|
781
805
|
exports.OrderModifier = OrderModifier = __decorate([
|
|
@@ -793,6 +817,7 @@ exports.OrderModifier = OrderModifier = __decorate([
|
|
|
793
817
|
event_bus_2.EventBus,
|
|
794
818
|
shipping_calculator_1.ShippingCalculator,
|
|
795
819
|
history_service_1.HistoryService,
|
|
796
|
-
translator_service_1.TranslatorService
|
|
820
|
+
translator_service_1.TranslatorService,
|
|
821
|
+
stock_level_service_1.StockLevelService])
|
|
797
822
|
], OrderModifier);
|
|
798
823
|
//# sourceMappingURL=order-modifier.js.map
|