feat(wallet): add credit wallet charge functionality and update payment callback
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
- Introduced methods for initiating and verifying credit wallet charges in the WalletService. - Updated PaymentCallback.razor to handle credit wallet charge verification. - Added a button for charging the credit wallet in Wallet.razor. - Updated route constants to include the new credit wallet charge route. These changes enhance the wallet functionality by allowing users to charge their credit wallets and verify transactions seamlessly.
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
@attribute [Route(RouteConstants.Profile.ChargeCreditWallet)]
|
||||
@attribute [Authorize]
|
||||
|
||||
<PageTitle>شارژ کیفپول اصلی</PageTitle>
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.Medium" Class="py-6">
|
||||
<MudStack Spacing="3">
|
||||
<PageHeader Title="💳 شارژ کیفپول اصلی" BackHref="@RouteConstants.Profile.Wallet" />
|
||||
|
||||
@if (_paymentResult != null)
|
||||
{
|
||||
<MudAlert Severity="@(_paymentResult == "success" ? MudBlazor.Severity.Success : MudBlazor.Severity.Error)"
|
||||
Class="rounded-lg" Variant="Variant.Filled">
|
||||
@if (_paymentResult == "success")
|
||||
{
|
||||
<span>شارژ کیف پول اصلی با موفقیت انجام شد! ✅</span>
|
||||
}
|
||||
else if (_paymentResult == "cancelled")
|
||||
{
|
||||
<span>پرداخت توسط شما لغو شد.</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>پرداخت ناموفق بود. لطفاً دوباره تلاش کنید.</span>
|
||||
}
|
||||
</MudAlert>
|
||||
}
|
||||
|
||||
<MudPaper Elevation="2" Class="pa-5 rounded-lg">
|
||||
<MudText Typo="Typo.h6" Class="mb-3">
|
||||
<MudIcon Icon="@Icons.Material.Filled.AccountBalanceWallet" Class="ml-1" />
|
||||
شارژ موجودی اصلی
|
||||
</MudText>
|
||||
|
||||
<MudAlert Severity="MudBlazor.Severity.Info" Dense="true" Class="mb-3" Icon="@Icons.Material.Filled.Info">
|
||||
مبلغ وارد شده (به تومان) از طریق درگاه پرداخت به موجودی اصلی شما اضافه میشود.
|
||||
از موجودی اصلی برای خرید از فروشگاه عادی و پرداخت سفارش استفاده میشود.
|
||||
</MudAlert>
|
||||
|
||||
<MudStack Spacing="2">
|
||||
<MudNumericField @bind-Value="_chargeAmount"
|
||||
Label="مبلغ (تومان)"
|
||||
Variant="Variant.Outlined"
|
||||
Min="10_000"
|
||||
Max="1_000_000_000"
|
||||
Format="N0"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.Payments"
|
||||
HelperText="حداقل ۱۰,۰۰۰ و حداکثر ۱,۰۰۰,۰۰۰,۰۰۰ تومان" />
|
||||
|
||||
<MudStack Row="true" Spacing="1" Class="flex-wrap">
|
||||
@foreach (var preset in _presetAmounts)
|
||||
{
|
||||
<MudButton Variant="Variant.Outlined" Size="Size.Small"
|
||||
Color="@(_chargeAmount == preset ? Color.Primary : Color.Default)"
|
||||
OnClick="() => _chargeAmount = preset"
|
||||
Class="rounded-pill">
|
||||
@FormatToman(preset)
|
||||
</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
|
||||
@if (_chargeAmount > 0)
|
||||
{
|
||||
<MudPaper Outlined="true" Class="pa-3 rounded-lg" Style="background: #eff6ff;">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween">
|
||||
<MudText Typo="Typo.body2">مبلغ پرداخت:</MudText>
|
||||
<MudText Typo="Typo.body2"><strong>@FormatToman(_chargeAmount)</strong></MudText>
|
||||
</MudStack>
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween">
|
||||
<MudText Typo="Typo.body2">موجودی دریافتی:</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Primary"><strong>@FormatToman(_chargeAmount)</strong></MudText>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
}
|
||||
|
||||
<MudButton Variant="Variant.Filled"
|
||||
Color="Color.Primary"
|
||||
Size="Size.Large"
|
||||
FullWidth="true"
|
||||
Disabled="@(_isProcessing || _chargeAmount < 10_000)"
|
||||
OnClick="StartCreditCharge"
|
||||
StartIcon="@Icons.Material.Filled.Payment"
|
||||
Class="rounded-lg mt-2">
|
||||
@if (_isProcessing)
|
||||
{
|
||||
<MudProgressCircular Size="Size.Small" Indeterminate="true" Class="me-2" />
|
||||
<span>در حال انتقال به درگاه...</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>پرداخت با کارت بانکی</span>
|
||||
}
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
|
||||
<MudExpansionPanels Elevation="1" Class="rounded-lg">
|
||||
<MudExpansionPanel Text="قوانین شارژ کیف پول اصلی" MaxHeight="500" IsInitiallyExpanded="false">
|
||||
<MudList T="string" Dense="true">
|
||||
<MudListItem T="string" Icon="@Icons.Material.Filled.CheckCircle" IconColor="Color.Success">
|
||||
موجودی اصلی برای خرید از فروشگاه عادی و پرداخت سفارش قابل استفاده است
|
||||
</MudListItem>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Filled.CheckCircle" IconColor="Color.Success">
|
||||
حداقل مبلغ شارژ: ۱۰,۰۰۰ تومان
|
||||
</MudListItem>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Filled.CheckCircle" IconColor="Color.Success">
|
||||
مبلغ واریزی بدون ضریب به موجودی اضافه میشود (۱:۱)
|
||||
</MudListItem>
|
||||
<MudListItem T="string" Icon="@Icons.Material.Filled.Info" IconColor="Color.Info">
|
||||
پرداخت از طریق درگاه بانکی انجام میشود
|
||||
</MudListItem>
|
||||
</MudList>
|
||||
</MudExpansionPanel>
|
||||
</MudExpansionPanels>
|
||||
</MudStack>
|
||||
</MudContainer>
|
||||
Reference in New Issue
Block a user