namespace CMSMicroservice.Application.Common.Interfaces;
///
/// Per-scope in-process mutex for payment flows (initiate / verify).
/// Prevents the same user from running duplicate gateway operations concurrently.
///
public interface IUserPaymentLock
{
Task ExecuteAsync(
string scope,
PaymentLockStrategy strategy,
Func> action,
CancellationToken cancellationToken = default);
Task ExecuteAsync(
string scope,
PaymentLockStrategy strategy,
Func action,
CancellationToken cancellationToken = default);
}
///
/// How to behave when the payment lock is already held.
///
public enum PaymentLockStrategy
{
/// Wait up to the configured timeout (callback / verify paths).
WaitForRelease,
/// Reject immediately (initiate / double-click paths).
FailFast
}