feat(POS-002): completed feature

This commit is contained in:
chattie
2026-08-21 21:55:43 +02:00
parent c68cb25ed6
commit 0a1d32ecc3
33 changed files with 1169 additions and 107 deletions

View File

@@ -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,