Update return invoice handling
This commit is contained in:
@@ -78,7 +78,9 @@ public class ReturnService(
|
|||||||
if (request.Items is null || request.Items.Count == 0)
|
if (request.Items is null || request.Items.Count == 0)
|
||||||
throw new InvalidOperationException("A return must have at least one line item.");
|
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.");
|
?? throw new InvalidOperationException("Sale not found for this order.");
|
||||||
if (sale.FK_RideId is null)
|
if (sale.FK_RideId is null)
|
||||||
throw new InvalidOperationException("A return can only be recorded for an order created during an active ride.");
|
throw new InvalidOperationException("A return can only be recorded for an order created during an active ride.");
|
||||||
|
|||||||
Reference in New Issue
Block a user