feat: add HasLockedInvoiceAsync method to check invoice status and prevent scheme application

This commit is contained in:
2026-10-22 10:40:43 +05:30
parent e84ce29064
commit fdfca7cf5e
3 changed files with 8 additions and 0 deletions
@@ -383,6 +383,9 @@ public class SchemeService(
if (await repo.HasRedemptionAsync(schemeId, shopPOId))
throw new InvalidOperationException("This scheme has already been redeemed against this ShopPO.");
if (await repo.HasLockedInvoiceAsync(shopPOId))
throw new InvalidOperationException("This order's invoice is already printed or finalized, so a scheme can no longer be applied. Apply schemes before the invoice is printed.");
var items = await shopPORepo.GetActiveItemsByShopPOIdAsync(shopPOId);
var eligibility = EvaluateRule(scheme, items);
if (!eligibility.Eligible)