mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
Merge branch 'feat/overselling-telur' into 'development'
add validasi overselling telur See merge request mbugroup/lti-api!587
This commit is contained in:
@@ -979,7 +979,10 @@ func (s deliveryOrdersService) consumeDeliveryStock(ctx context.Context, tx *gor
|
||||
marketingProduct.ProductWarehouseId,
|
||||
resolveMarketingAsOf(deliveryProduct.DeliveryDate, deliveryProduct.CreatedAt),
|
||||
); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("Insufficient stock for product warehouse %d: %v", marketingProduct.ProductWarehouseId, err))
|
||||
if errors.Is(err, fifoV2.ErrInsufficientStock) {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Stok tidak mencukupi untuk memenuhi permintaan delivery order ini")
|
||||
}
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("Gagal mengalokasikan stok: %v", err))
|
||||
}
|
||||
|
||||
refreshed, err := deliveryProductRepo.GetByID(ctx, deliveryProduct.Id, nil)
|
||||
|
||||
Reference in New Issue
Block a user