feat(payment): add per-user in-memory lock for gateway operations
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 9m58s

Introduce IUserPaymentLock to serialize payment initiate and verify flows
per user, preventing concurrent duplicate gateway requests across services.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
masoodafar-web
2026-06-08 01:55:00 +03:30
parent f08d3ac78f
commit d22eb1617f
14 changed files with 543 additions and 66 deletions
@@ -0,0 +1,22 @@
namespace CMSMicroservice.Application.Common.Exceptions;
/// <summary>
/// Thrown when a concurrent payment operation is already in progress for the same scope.
/// </summary>
public class PaymentInProgressException : Exception
{
public PaymentInProgressException()
: base("یک عملیات پرداخت دیگر در حال پردازش است. لطفاً چند لحظه صبر کنید.")
{
}
public PaymentInProgressException(string message)
: base(message)
{
}
public PaymentInProgressException(string message, Exception innerException)
: base(message, innerException)
{
}
}