Merge pull request 'Refactored idempotency check to observe completed status' (#116) from payments into master

Reviewed-on: #116
This commit was merged in pull request #116.
This commit is contained in:
2026-06-13 18:04:17 +02:00
@@ -123,8 +123,7 @@ public sealed class PaymentService(IDbContextFactory<MidrandBooksDbContext> 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);
}