diff --git a/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor b/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor
new file mode 100644
index 0000000..6016d2f
--- /dev/null
+++ b/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor
@@ -0,0 +1,121 @@
+@attribute [Route(RouteConstants.Profile.ChargeDiscountWallet)]
+@attribute [Authorize]
+
+شارژ کیفپول اعتباری
+
+
+
+
+
+ @* ─── نتیجه پرداخت (اگه از callback برگشته) ─── *@
+ @if (_paymentResult != null)
+ {
+
+ @if (_paymentResult == "success")
+ {
+ شارژ اعتباری با موفقیت انجام شد! ✅
+ }
+ else if (_paymentResult == "cancelled")
+ {
+ پرداخت توسط شما لغو شد.
+ }
+ else
+ {
+ پرداخت ناموفق بود. لطفاً دوباره تلاش کنید.
+ }
+
+ }
+
+ @* ─── فرم شارژ ─── *@
+
+
+
+ شارژ موجودی اعتباری
+
+
+
+ مبلغ وارد شده (به تومان) از طریق درگاه پرداخت به موجودی اعتباری شما اضافه میشود.
+ از موجودی اعتباری فقط برای خرید از فروشگاه تخفیفی میتوانید استفاده کنید.
+
+
+
+
+
+ @* دکمههای مبلغ سریع *@
+
+ @foreach (var preset in _presetAmounts)
+ {
+
+ @FormatToman(preset)
+
+ }
+
+
+ @if (_chargeAmount > 0)
+ {
+
+
+ مبلغ پرداخت:
+ @FormatToman(_chargeAmount)
+
+
+ اعتبار دریافتی:
+ @FormatToman(_chargeAmount)
+
+
+ }
+
+
+ @if (_isProcessing)
+ {
+
+ در حال انتقال به درگاه...
+ }
+ else
+ {
+ پرداخت از درگاه
+ }
+
+
+
+
+ @* ─── قوانین ─── *@
+
+
+
+
+ موجودی اعتباری فقط قابل استفاده در فروشگاه تخفیفی است
+
+
+ حداقل مبلغ شارژ: ۱۰,۰۰۰ تومان
+
+
+ مبلغ واریزی بدون ضریب به موجودی اضافه میشود (۱:۱)
+
+
+ پرداخت از طریق درگاه بانکی انجام میشود
+
+
+
+
+
+
diff --git a/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor.cs b/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor.cs
new file mode 100644
index 0000000..1d3ffaf
--- /dev/null
+++ b/src/FrontOffice.Main/Pages/Profile/ChargeDiscountWallet.razor.cs
@@ -0,0 +1,59 @@
+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
+ {
+ // تبدیل تومان به ریال
+ var amountInRial = _chargeAmount * 10;
+
+ var (success, gatewayUrl, error) = await WalletService.InitiateDiscountChargeAsync(amountInRial);
+
+ 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);
+}
diff --git a/src/FrontOffice.Main/Pages/Profile/Wallet.razor b/src/FrontOffice.Main/Pages/Profile/Wallet.razor
index 5c79048..8cdcbad 100644
--- a/src/FrontOffice.Main/Pages/Profile/Wallet.razor
+++ b/src/FrontOffice.Main/Pages/Profile/Wallet.razor
@@ -38,6 +38,17 @@
درخواستهای برداشت
+
+
+ شارژ کیفپول اعتباری
+
+
تراکنشها و مسیرهای شارژ
diff --git a/src/FrontOffice.Main/Utilities/RouteConstants.cs b/src/FrontOffice.Main/Utilities/RouteConstants.cs
index a1de966..0c57869 100644
--- a/src/FrontOffice.Main/Utilities/RouteConstants.cs
+++ b/src/FrontOffice.Main/Utilities/RouteConstants.cs
@@ -23,6 +23,7 @@ public static class RouteConstants
public const string Tree = "/profile/tree";
public const string Wallet = "/profile/wallet";
public const string MagicWallet = "/profile/magic-wallet";
+ public const string ChargeDiscountWallet = "/profile/charge-discount-wallet";
public const string WithdrawalRequests = "/profile/withdrawal-requests";
}
diff --git a/src/FrontOffice.Main/Utilities/WalletService.cs b/src/FrontOffice.Main/Utilities/WalletService.cs
index 9d21f05..5b0bcfb 100644
--- a/src/FrontOffice.Main/Utilities/WalletService.cs
+++ b/src/FrontOffice.Main/Utilities/WalletService.cs
@@ -243,6 +243,26 @@ public class WalletService
}
}
+ public async Task<(bool Success, string? GatewayUrl, string? Error)> InitiateDiscountChargeAsync(long amount)
+ {
+ try
+ {
+ var response = await _client.InitiateDiscountChargeAsync(new InitiateDiscountChargeRequest
+ {
+ Amount = amount
+ });
+
+ if (response.IsSuccess)
+ return (true, response.GatewayUrl, null);
+
+ return (false, null, response.ErrorMessage);
+ }
+ catch (Grpc.Core.RpcException ex)
+ {
+ return (false, null, ex.Status.Detail ?? "خطا در ارتباط با سرور");
+ }
+ }
+
public int GetWalletMode()
{
try