From 94b0084d752b474f35ad7822534461c10a600f36 Mon Sep 17 00:00:00 2001 From: Khwezi Mngoma Date: Sat, 13 Jun 2026 18:03:40 +0200 Subject: [PATCH] Refactored idempotency check to observe completed status --- LiteCharms.Features.MidrandBooks/Payments/PaymentService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LiteCharms.Features.MidrandBooks/Payments/PaymentService.cs b/LiteCharms.Features.MidrandBooks/Payments/PaymentService.cs index 1f39876..b1a3531 100644 --- a/LiteCharms.Features.MidrandBooks/Payments/PaymentService.cs +++ b/LiteCharms.Features.MidrandBooks/Payments/PaymentService.cs @@ -123,8 +123,7 @@ public sealed class PaymentService(IDbContextFactory cont await using var context = await contextFactory.CreateDbContextAsync(cancellationToken); var exists = await context.Ledger.AnyAsync(l => - l.OrderId == orderId && - l.PaymentId == paymentId, cancellationToken); + l.OrderId == orderId && l.PaymentId == paymentId && l.Status == LedgerStatuses.Completed, cancellationToken); return Result.Ok(exists); }