fix: remove double ×10 Rial conversion in ZarinPalPaymentService
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled

Root cause: FrontOffice already converts Toman→Rial (×10) before sending
to CMS. ZarinPalPaymentService was multiplying by 10 AGAIN, causing
amounts to be 10x too large.

Example: user enters 500K Toman → FO sends 5M Rial → CMS did ×10 → 50M
Rial sent to ZarinPal → showed 5M Toman instead of 500K.

Changes:
- ZarinPalPaymentService.InitiatePaymentAsync: remove ×10 (amount already Rial)
- ZarinPalPaymentService.VerifyPaymentWithAmountAsync: remove ×10 + accept Rial
- ZarinPalPaymentService.VerifyResult.Amount: return Rial (no /10 conversion)
- VerifyMagicWalletChargeCommandHandler: remove /10 before calling Verify
- PaymentCallbackController: update comments (amount is Rial)
- Also includes: improved HTTP error logging for non-200 responses
- Also includes: production URL fix (kbs1→kbs2)
This commit is contained in:
masoodafar-web
2026-02-24 00:49:16 +03:30
parent e206b71186
commit cbaa20f339
4 changed files with 32 additions and 22 deletions
@@ -74,12 +74,11 @@ public class VerifyMagicWalletChargeCommandHandler
throw new BadRequestException("پرداخت توسط کاربر لغو شد");
}
// 3. Verify با درگاه (زرین‌پال نیاز به مبلغ دارد)
var amountInToman = depositAmount / 10m;
// 3. Verify با درگاه (مبلغ به ریال)
var verifyResult = await _paymentGateway.VerifyPaymentAsync(
request.Authority,
request.Status,
amountInToman,
depositAmount,
cancellationToken
);