feat(POS-002): completed feature
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { InventoryServicePort } from '../../inventory/index.js';
|
||||
import { DEFAULT_STORE_ID, type InventoryServicePort } from '../../inventory/index.js';
|
||||
import type { PricingServicePort } from '../../pricing/index.js';
|
||||
import type { PromotionServicePort } from '../../promotions/index.js';
|
||||
import { InvalidCartQuantityError, InsufficientCartStockError } from '../domain/errors.js';
|
||||
@@ -30,7 +30,7 @@ export class CartService {
|
||||
}
|
||||
|
||||
private async assertStockAvailable(variantId: string, quantity: number): Promise<void> {
|
||||
const av = await this.inventory.checkAvailability(variantId, quantity);
|
||||
const av = await this.inventory.checkAvailability(variantId, DEFAULT_STORE_ID, quantity);
|
||||
if (!av.available) {
|
||||
throw new InsufficientCartStockError(variantId, quantity, av.availableQuantity);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export class CartService {
|
||||
if (error instanceof Error && error.name === 'PriceNotFoundError') return null;
|
||||
throw error;
|
||||
}),
|
||||
this.inventory.checkAvailability(item.variantId, item.quantity),
|
||||
this.inventory.checkAvailability(item.variantId, DEFAULT_STORE_ID, item.quantity),
|
||||
]);
|
||||
return {
|
||||
...item,
|
||||
|
||||
Reference in New Issue
Block a user