Update return invoice handling

This commit is contained in:
2026-09-16 16:25:50 +05:30
parent 4b56443d1a
commit f42809a4e3
@@ -78,7 +78,9 @@ public class ReturnService(
if (request.Items is null || request.Items.Count == 0)
throw new InvalidOperationException("A return must have at least one line item.");
var sale = await saleRepo.GetByIdAsync(order.FK_SaleId)
if (order.FK_SaleId is null)
throw new InvalidOperationException("Sale not found for this order.");
var sale = await saleRepo.GetByIdAsync(order.FK_SaleId.Value)
?? throw new InvalidOperationException("Sale not found for this order.");
if (sale.FK_RideId is null)
throw new InvalidOperationException("A return can only be recorded for an order created during an active ride.");