fix(payment): set TwentyCard package amounts and send rials to gateway
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2s

Gateway 11,200,000 toman and wallet credit 12,656,000 toman; multiply by 10 when posting to TwentyCard API.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
masoodafar-web
2026-09-23 15:12:08 +03:30
parent 9b82b45e46
commit 6f573c0a29
5 changed files with 22 additions and 20 deletions
@@ -58,7 +58,9 @@ public class TwentyCardPaymentService : IPaymentGatewayService
{
try
{
var amount = ((long)request.Amount).ToString();
// ۲۰کارت amount را به ریال می‌گیرد (تومان × ۱۰)
var amountRial = ((long)request.Amount) * 10L;
var amount = amountRial.ToString();
var payerName = string.IsNullOrWhiteSpace(request.Name)
? (string.IsNullOrWhiteSpace(request.Mobile) ? "کاربر" : request.Mobile)
: request.Name.Trim();
@@ -85,8 +87,8 @@ public class TwentyCardPaymentService : IPaymentGatewayService
AddFormField(content, "national_id", request.NationalId);
_logger.LogInformation(
"TwentyCard payment request: Amount={Amount} Toman, User={UserId}, Invoice={Invoice}",
amount, request.UserId, invoice);
"TwentyCard payment request: Amount={AmountToman} Toman ({AmountRial} Rial), User={UserId}, Invoice={Invoice}",
(long)request.Amount, amountRial, request.UserId, invoice);
var response = await _httpClient.PostAsync("api/pgw/merchant/request", content, cancellationToken);
var responseBody = await response.Content.ReadAsStringAsync(cancellationToken);
@@ -169,7 +171,7 @@ public class TwentyCardPaymentService : IPaymentGatewayService
["terminal_username"] = _terminalUsername,
["terminal_password"] = _terminalPassword,
["authority"] = refId,
["amount"] = ((long)amountInToman).ToString()
["amount"] = (((long)amountInToman) * 10L).ToString()
});
var response = await _httpClient.PostAsync("api/pgw/merchant/verify", content, cancellationToken);
@@ -14,12 +14,12 @@
"DefaultEmail": "info@kbs2.ir",
"Packages": {
"4": {
"GatewayAmountToman": 1000,
"WalletCreditToman": 13000000
"GatewayAmountToman": 11200000,
"WalletCreditToman": 12656000
},
"1": {
"GatewayAmountToman": 1000,
"WalletCreditToman": 130000000
"GatewayAmountToman": 11200000,
"WalletCreditToman": 12656000
}
}
},
+4 -4
View File
@@ -13,12 +13,12 @@
"DefaultEmail": "info@kbs2.ir",
"Packages": {
"4": {
"GatewayAmountToman": 9700000,
"WalletCreditToman": 13000000
"GatewayAmountToman": 11200000,
"WalletCreditToman": 12656000
},
"1": {
"GatewayAmountToman": 97000000,
"WalletCreditToman": 130000000
"GatewayAmountToman": 11200000,
"WalletCreditToman": 12656000
}
}
},