fix: Toman/Rial — system uses Toman everywhere, only ZarinPal gets Rial
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 10m16s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 10m16s
Core change in ZarinPalPaymentService: - InitiatePaymentAsync: Amount (Toman) × 10 → Rial for gateway - VerifyPaymentWithAmountAsync: Amount (Toman) × 10 → Rial for verify - Verify result: gateway Rial ÷ 10 → Toman back to system Also fixed: - Package.Price doc: ریال → تومان - Error messages in 3 handlers: ریال → تومان - ConfigurationService descriptions: ریال → تومان (7 entries) - Notification SMS/email: ریال → تومان - Doc comments in 5 command files: ریال → تومان - PaymentCallback comments: ریال → تومان 14 files changed across Domain, Application, Infrastructure, WebApi
This commit is contained in:
@@ -78,7 +78,7 @@ public class UserNotificationService : IUserNotificationService
|
||||
var emailSubject = $"واریز کمیسیون هفته {weekNumber}{packageInfo}";
|
||||
var emailBody = "<div dir='rtl' style='font-family: Tahoma, Arial; text-align: right;'>" +
|
||||
$"<h2>سلام {userFullName}</h2>" +
|
||||
$"<p>کمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ <strong>{formattedAmount} ریال</strong> به کیف پول شما واریز شد.</p>" +
|
||||
$"<p>کمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ <strong>{formattedAmount} تومان</strong> به کیف پول شما واریز شد.</p>" +
|
||||
"<p>از اعتماد شما سپاسگزاریم.</p>" +
|
||||
"<hr/>" +
|
||||
"<p style='color: #666; font-size: 12px;'>FourSat - سیستم مدیریت باشگاه مشتریان</p>" +
|
||||
@@ -97,7 +97,7 @@ public class UserNotificationService : IUserNotificationService
|
||||
{
|
||||
await SendSmsAsync(
|
||||
phoneNumber: user.Mobile,
|
||||
message: $"سلام {userFullName}\nکمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ {formattedAmount} ریال واریز شد.\nFourSat",
|
||||
message: $"سلام {userFullName}\nکمیسیون هفته {weekNumber} شما{packageInfo} به مبلغ {formattedAmount} تومان واریز شد.\nFourSat",
|
||||
cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,9 @@ public class ZarinPalPaymentService : IPaymentGatewayService
|
||||
{
|
||||
try
|
||||
{
|
||||
// مبلغ از caller به ریال میرسد — مستقیم ارسال به زرینپال
|
||||
var amountInRials = (long)request.Amount;
|
||||
// مبلغ از caller به تومان میرسد — تبدیل به ریال برای زرینپال (×10)
|
||||
var amountInToman = (long)request.Amount;
|
||||
var amountInRials = amountInToman * 10;
|
||||
|
||||
var zarinPalRequest = new ZarinPalPaymentRequest
|
||||
{
|
||||
@@ -85,8 +86,8 @@ public class ZarinPalPaymentService : IPaymentGatewayService
|
||||
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
||||
|
||||
_logger.LogInformation(
|
||||
"ZarinPal payment request: Amount={AmountRial} Rial ({AmountToman} Toman), User={UserId}, Sandbox={Sandbox}",
|
||||
amountInRials, amountInRials / 10m, request.UserId, _useSandbox);
|
||||
"ZarinPal payment request: Amount={AmountToman} Toman ({AmountRial} Rial), User={UserId}, Sandbox={Sandbox}",
|
||||
amountInToman, amountInRials, request.UserId, _useSandbox);
|
||||
|
||||
var response = await _httpClient.PostAsync(RequestEndpoint, content, cancellationToken);
|
||||
var responseBody = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
@@ -167,7 +168,7 @@ public class ZarinPalPaymentService : IPaymentGatewayService
|
||||
|
||||
/// <summary>
|
||||
/// تأیید پرداخت با مبلغ — نسخه اصلی برای زرینپال
|
||||
/// refId = Authority، verificationToken = Status (OK/NOK)، amount = مبلغ به ریال
|
||||
/// refId = Authority، verificationToken = Status (OK/NOK)، amount = مبلغ به تومان
|
||||
/// </summary>
|
||||
public Task<PaymentVerificationResult> VerifyPaymentAsync(
|
||||
string refId,
|
||||
@@ -181,7 +182,7 @@ public class ZarinPalPaymentService : IPaymentGatewayService
|
||||
private async Task<PaymentVerificationResult> VerifyPaymentWithAmountAsync(
|
||||
string refId,
|
||||
string verificationToken,
|
||||
decimal amountInRials,
|
||||
decimal amountInToman,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
@@ -198,18 +199,21 @@ public class ZarinPalPaymentService : IPaymentGatewayService
|
||||
};
|
||||
}
|
||||
|
||||
// تبدیل تومان به ریال برای زرینپال (×10)
|
||||
var amountInRials = (long)(amountInToman * 10);
|
||||
|
||||
var verifyRequest = new ZarinPalVerifyRequest
|
||||
{
|
||||
MerchantId = _merchantId,
|
||||
Authority = refId,
|
||||
Amount = (long)amountInRials
|
||||
Amount = amountInRials
|
||||
};
|
||||
|
||||
var jsonContent = JsonSerializer.Serialize(verifyRequest, JsonOptions);
|
||||
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
||||
|
||||
_logger.LogInformation("ZarinPal verify request: Authority={Authority}, Amount={Amount} Rial ({AmountToman} Toman)",
|
||||
refId, (long)amountInRials, amountInRials / 10m);
|
||||
_logger.LogInformation("ZarinPal verify request: Authority={Authority}, Amount={AmountToman} Toman ({AmountRial} Rial)",
|
||||
refId, (long)amountInToman, amountInRials);
|
||||
|
||||
var response = await _httpClient.PostAsync(VerifyEndpoint, content, cancellationToken);
|
||||
var responseBody = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
@@ -231,7 +235,7 @@ public class ZarinPalPaymentService : IPaymentGatewayService
|
||||
IsSuccess = true,
|
||||
RefId = refId,
|
||||
TrackingCode = result.Data.RefId?.ToString(),
|
||||
Amount = result.Data.Amount ?? 0, // ریال — بدون تبدیل
|
||||
Amount = (result.Data.Amount ?? 0) / 10, // تبدیل ریال → تومان
|
||||
CardPan = result.Data.CardPan,
|
||||
CardHash = result.Data.CardHash,
|
||||
VerificationCode = result.Data.Code,
|
||||
|
||||
Reference in New Issue
Block a user