fix: pass amount to ZarinPal VerifyPaymentAsync — fix verify failure (amount=0 bug)
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m38s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m38s
- PackageService.CustomerVerifyPackagePurchase: look up PaymentTransaction.Amount and pass to 3-arg overload - TransactionsService.CustomerPaymentVerification: same fix - VerifyDiscountWalletChargeCommandHandler: look up amount from PaymentTransaction - VerifyPackagePurchaseCommandHandler: fix copy-paste bug (Authority as verificationToken) + add amount - IPaymentGatewayService: throw NotImplementedException in default 3-arg impl to prevent silent amount=0 - MockPaymentGatewayService & DayaPaymentService: add 3-arg overload for compatibility Root cause: ZarinPal requires the exact amount in verify request. The 2-arg overload was sending amount=0 which caused Code=-1 (تأیید تراکنش ناموفق).
This commit is contained in:
@@ -274,13 +274,15 @@ public class PackageService : PackageContract.PackageContractBase
|
||||
};
|
||||
}
|
||||
|
||||
// Verify with payment gateway
|
||||
var verifyResult = await _paymentGateway.VerifyPaymentAsync(
|
||||
request.Authority, request.Status, context.CancellationToken);
|
||||
|
||||
// آپدیت PaymentTransaction
|
||||
// واکشی PaymentTransaction برای گرفتن مبلغ (تومان) جهت verify
|
||||
var paymentTx = await _context.PaymentTransactions
|
||||
.FirstOrDefaultAsync(pt => pt.Authority == request.Authority, context.CancellationToken);
|
||||
|
||||
var amountInToman = paymentTx?.Amount ?? purchase.Amount;
|
||||
|
||||
// Verify with payment gateway (مبلغ به تومان — سرویس زرینپال خودش ×۱۰ میکنه)
|
||||
var verifyResult = await _paymentGateway.VerifyPaymentAsync(
|
||||
request.Authority, request.Status, (decimal)amountInToman, context.CancellationToken);
|
||||
if (paymentTx != null)
|
||||
{
|
||||
paymentTx.PaymentStatus = verifyResult.IsSuccess;
|
||||
|
||||
@@ -235,13 +235,15 @@ public class TransactionsService : TransactionsContract.TransactionsContractBase
|
||||
};
|
||||
}
|
||||
|
||||
// Verify with gateway
|
||||
var verifyResult = await _paymentGateway.VerifyPaymentAsync(
|
||||
request.Authority, request.Status, context.CancellationToken);
|
||||
|
||||
// آپدیت PaymentTransaction
|
||||
// واکشی PaymentTransaction برای گرفتن مبلغ (تومان) جهت verify
|
||||
var paymentTx = await _context.PaymentTransactions
|
||||
.FirstOrDefaultAsync(pt => pt.Authority == request.Authority, context.CancellationToken);
|
||||
|
||||
var amountInToman = paymentTx?.Amount ?? transaction.Amount;
|
||||
|
||||
// Verify with gateway (مبلغ به تومان — سرویس زرینپال خودش ×۱۰ میکنه)
|
||||
var verifyResult = await _paymentGateway.VerifyPaymentAsync(
|
||||
request.Authority, request.Status, (decimal)amountInToman, context.CancellationToken);
|
||||
if (paymentTx != null)
|
||||
{
|
||||
paymentTx.PaymentStatus = verifyResult.IsSuccess;
|
||||
|
||||
Reference in New Issue
Block a user