d22eb1617f
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>
20 lines
798 B
C#
20 lines
798 B
C#
namespace CMSMicroservice.Application.Common;
|
|
|
|
/// <summary>
|
|
/// Canonical scope keys for <see cref="Interfaces.IUserPaymentLock"/>.
|
|
/// </summary>
|
|
public static class PaymentLockScopes
|
|
{
|
|
/// <summary>One active payment initiation per user (package, wallet charge, order, IPG deposit).</summary>
|
|
public static string Initiate(long userId) => $"payment:initiate:user:{userId}";
|
|
|
|
/// <summary>One active verify per user + authority/order (duplicate callback protection).</summary>
|
|
public static string Verify(long userId, string resourceKey)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(resourceKey))
|
|
throw new ArgumentException("Payment verify resource key is required.", nameof(resourceKey));
|
|
|
|
return $"payment:verify:user:{userId}:{resourceKey.Trim()}";
|
|
}
|
|
}
|