fix: remove double ×10 conversion in wallet charge — FO should send Toman, not Rial
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m40s

Root cause: FrontOffice was converting Toman→Rial (×10) before sending to CMS,
but CMS ZarinPalService already does Toman→Rial conversion internally.
This caused double ×10 = amounts shown 10x higher in payment gateway.

Fixes:
- MagicWallet.razor.cs: remove ×10 conversion, send _chargeAmount (Toman) directly
- MagicWallet.razor: fix Max field (no /10), fix preset filter (no ×10)
- MagicWallet.razor.cs: fix FormatPrice — values from CMS are Toman, not Rial
- ChargeDiscountWallet.razor.cs: same fix — send Toman directly
- ClubMembershipContractDialog.razor: fix Price display (no /10)
This commit is contained in:
masoodafar-web
2026-02-27 21:53:01 +03:30
parent 5ded91a58a
commit 2f9ef15859
4 changed files with 9 additions and 13 deletions
@@ -29,10 +29,8 @@ public partial class ChargeDiscountWallet : ComponentBase
try try
{ {
// تبدیل تومان به ریال // مبلغ به تومان — CMS خودش موقع ارسال به درگاه ×۱۰ می‌کنه
var amountInRial = _chargeAmount * 10; var (success, gatewayUrl, error) = await WalletService.InitiateDiscountChargeAsync(_chargeAmount);
var (success, gatewayUrl, error) = await WalletService.InitiateDiscountChargeAsync(amountInRial);
if (success && !string.IsNullOrEmpty(gatewayUrl)) if (success && !string.IsNullOrEmpty(gatewayUrl))
{ {
@@ -106,7 +106,7 @@
Label="مبلغ واریز (تومان)" Label="مبلغ واریز (تومان)"
Variant="Variant.Outlined" Variant="Variant.Outlined"
Min="10_000" Min="10_000"
Max="@(_status.MagicRemainingDeposit / 10)" Max="@_status.MagicRemainingDeposit"
Format="N0" Format="N0"
Adornment="Adornment.Start" Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Payments" AdornmentIcon="@Icons.Material.Filled.Payments"
@@ -130,7 +130,7 @@
<MudStack Row="true" Spacing="1" Class="flex-wrap"> <MudStack Row="true" Spacing="1" Class="flex-wrap">
@foreach (var preset in _presetAmounts) @foreach (var preset in _presetAmounts)
{ {
if (preset * 10 <= _status.MagicRemainingDeposit) if (preset <= _status.MagicRemainingDeposit)
{ {
<MudButton Variant="Variant.Outlined" Size="Size.Small" <MudButton Variant="Variant.Outlined" Size="Size.Small"
Color="@(_chargeAmount == preset ? Color.Primary : Color.Default)" Color="@(_chargeAmount == preset ? Color.Primary : Color.Default)"
@@ -46,10 +46,8 @@ public partial class MagicWallet : ComponentBase
try try
{ {
// تبدیل تومان به ریال // مبلغ به تومان — CMS خودش موقع ارسال به درگاه ×۱۰ می‌کنه
var amountInRial = _chargeAmount * 10; var (success, gatewayUrl, error) = await WalletService.InitiateMagicChargeAsync(_chargeAmount);
var (success, gatewayUrl, error) = await WalletService.InitiateMagicChargeAsync(amountInRial);
if (success && !string.IsNullOrEmpty(gatewayUrl)) if (success && !string.IsNullOrEmpty(gatewayUrl))
{ {
@@ -71,8 +69,8 @@ public partial class MagicWallet : ComponentBase
} }
} }
private static string FormatPrice(long priceInRial) private static string FormatPrice(long price)
=> string.Format("{0:N0} تومان", priceInRial / 10); => string.Format("{0:N0} تومان", price);
private static string FormatToman(long toman) private static string FormatToman(long toman)
=> string.Format("{0:N0} تومان", toman); => string.Format("{0:N0} تومان", toman);
@@ -136,7 +136,7 @@
if (basePackage != null) if (basePackage != null)
{ {
_packageDisplayName = basePackage.Title; _packageDisplayName = basePackage.Title;
_packageDisplayPrice = $"{basePackage.Price / 10:N0} تومان"; _packageDisplayPrice = $"{basePackage.Price:N0} تومان";
} }
} }
catch { /* fallback to defaults */ } catch { /* fallback to defaults */ }