From 2f9ef158598482c61f15e73d712b69ea4312dc5e Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Fri, 27 Feb 2026 21:53:01 +0330 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20double=20=C3=9710=20conversion?= =?UTF-8?q?=20in=20wallet=20charge=20=E2=80=94=20FO=20should=20send=20Toma?= =?UTF-8?q?n,=20not=20Rial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../Pages/Profile/ChargeDiscountWallet.razor.cs | 6 ++---- src/FrontOffice.Main/Pages/Profile/MagicWallet.razor | 4 ++-- .../Pages/Profile/MagicWallet.razor.cs | 10 ++++------ .../Shared/ClubMembershipContractDialog.razor | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor.cs b/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor.cs index 1d3ffaf..8c03390 100644 --- a/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor.cs +++ b/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor.cs @@ -29,10 +29,8 @@ public partial class ChargeDiscountWallet : ComponentBase try { - // تبدیل تومان به ریال - var amountInRial = _chargeAmount * 10; - - var (success, gatewayUrl, error) = await WalletService.InitiateDiscountChargeAsync(amountInRial); + // مبلغ به تومان — CMS خودش موقع ارسال به درگاه ×۱۰ می‌کنه + var (success, gatewayUrl, error) = await WalletService.InitiateDiscountChargeAsync(_chargeAmount); if (success && !string.IsNullOrEmpty(gatewayUrl)) { diff --git a/src/FrontOffice.Main/Pages/Profile/MagicWallet.razor b/src/FrontOffice.Main/Pages/Profile/MagicWallet.razor index b9e3b35..f2301e4 100644 --- a/src/FrontOffice.Main/Pages/Profile/MagicWallet.razor +++ b/src/FrontOffice.Main/Pages/Profile/MagicWallet.razor @@ -106,7 +106,7 @@ Label="مبلغ واریز (تومان)" Variant="Variant.Outlined" Min="10_000" - Max="@(_status.MagicRemainingDeposit / 10)" + Max="@_status.MagicRemainingDeposit" Format="N0" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Payments" @@ -130,7 +130,7 @@ @foreach (var preset in _presetAmounts) { - if (preset * 10 <= _status.MagicRemainingDeposit) + if (preset <= _status.MagicRemainingDeposit) { string.Format("{0:N0} تومان", priceInRial / 10); + private static string FormatPrice(long price) + => string.Format("{0:N0} تومان", price); private static string FormatToman(long toman) => string.Format("{0:N0} تومان", toman); diff --git a/src/FrontOffice.Main/Shared/ClubMembershipContractDialog.razor b/src/FrontOffice.Main/Shared/ClubMembershipContractDialog.razor index 0315eb8..18f3ed9 100644 --- a/src/FrontOffice.Main/Shared/ClubMembershipContractDialog.razor +++ b/src/FrontOffice.Main/Shared/ClubMembershipContractDialog.razor @@ -136,7 +136,7 @@ if (basePackage != null) { _packageDisplayName = basePackage.Title; - _packageDisplayPrice = $"{basePackage.Price / 10:N0} تومان"; + _packageDisplayPrice = $"{basePackage.Price:N0} تومان"; } } catch { /* fallback to defaults */ }