2f9ef15859
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)
58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using FrontOffice.Main.Utilities;
|
|
using Microsoft.AspNetCore.Components;
|
|
using MudBlazor;
|
|
|
|
namespace FrontOffice.Main.Pages.Profile;
|
|
|
|
public partial class ChargeDiscountWallet : ComponentBase
|
|
{
|
|
private bool _isProcessing;
|
|
private long _chargeAmount;
|
|
private string? _paymentResult;
|
|
|
|
private readonly long[] _presetAmounts = { 500_000, 1_000_000, 5_000_000, 10_000_000, 20_000_000, 50_000_000 };
|
|
|
|
[SupplyParameterFromQuery(Name = "payment")]
|
|
public string? PaymentQueryParam { get; set; }
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_paymentResult = PaymentQueryParam;
|
|
}
|
|
|
|
private async Task StartDiscountCharge()
|
|
{
|
|
if (_chargeAmount <= 0 || _isProcessing) return;
|
|
|
|
_isProcessing = true;
|
|
StateHasChanged();
|
|
|
|
try
|
|
{
|
|
// مبلغ به تومان — CMS خودش موقع ارسال به درگاه ×۱۰ میکنه
|
|
var (success, gatewayUrl, error) = await WalletService.InitiateDiscountChargeAsync(_chargeAmount);
|
|
|
|
if (success && !string.IsNullOrEmpty(gatewayUrl))
|
|
{
|
|
Navigation.NavigateTo(gatewayUrl, forceLoad: true);
|
|
}
|
|
else
|
|
{
|
|
Snackbar.Add(error ?? "خطا در ایجاد درخواست پرداخت", Severity.Error);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
|
|
}
|
|
finally
|
|
{
|
|
_isProcessing = false;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
private static string FormatToman(long toman)
|
|
=> string.Format("{0:N0} تومان", toman);
|
|
}
|