fix: payment success page — show TransactionId, real wallet balance, fix back button
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m53s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 2m53s
- کد ارجاعی: از TransactionId جدول تراکنشها بجای RefId زرینپال - موجودی: از WalletService.GetBalancesAsync() موجودی واقعی کیف پول اصلی - حذف نمایش موجودی کیف پول اعتباری (نیازی نیست) - دکمه بازگشت: Href=/profile بجای history.back() (که به درگاه میرفت)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
@using Blazored.LocalStorage
|
||||
@using CMSMicroservice.Protobuf.Protos.Package
|
||||
@using CMSMicroservice.Protobuf.Protos.User
|
||||
@inject IJSRuntime JS
|
||||
@using FrontOffice.Main.Utilities
|
||||
|
||||
|
||||
<PageTitle>نتیجه پرداخت | کارا بازار سلامت</PageTitle>
|
||||
@@ -21,24 +21,21 @@
|
||||
<MudText Typo="Typo.h5" Color="Color.Success" Class="mt-4">پرداخت موفق</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mt-2">@_message</MudText>
|
||||
|
||||
@if (!string.IsNullOrEmpty(_refId))
|
||||
@if (_transactionId > 0)
|
||||
{
|
||||
<MudText Typo="Typo.body2" Class="mt-3">
|
||||
<strong>کد پیگیری:</strong> @_refId
|
||||
<strong>کد ارجاعی:</strong> @_transactionId
|
||||
</MudText>
|
||||
}
|
||||
|
||||
<MudDivider Class="my-4" />
|
||||
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">
|
||||
موجودی کیف پول اصلی: @FormatPrice(_walletBalance)
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">
|
||||
موجودی کیف پول اعتباری: @FormatPrice(_discountBalance)
|
||||
موجودی کیف پول: @FormatPrice(_walletBalance)
|
||||
</MudText>
|
||||
|
||||
<MudButton Color="Color.Primary" Variant="Variant.Filled" Class="mt-6"
|
||||
OnClick="GoBack">
|
||||
Href="/profile">
|
||||
بازگشت به پروفایل
|
||||
</MudButton>
|
||||
}
|
||||
@@ -49,7 +46,7 @@
|
||||
<MudText Typo="Typo.body1" Class="mt-2">@_message</MudText>
|
||||
|
||||
<MudButton Color="Color.Primary" Variant="Variant.Filled" Class="mt-6"
|
||||
OnClick="GoBack">
|
||||
Href="/profile">
|
||||
بازگشت به پروفایل
|
||||
</MudButton>
|
||||
|
||||
@@ -85,9 +82,8 @@
|
||||
private bool _isLoading = true;
|
||||
private bool _isSuccess;
|
||||
private string _message = string.Empty;
|
||||
private string? _refId;
|
||||
private long _transactionId;
|
||||
private long _walletBalance;
|
||||
private long _discountBalance;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
@@ -119,19 +115,18 @@
|
||||
|
||||
_isSuccess = response.Success;
|
||||
_message = response.Message;
|
||||
_refId = response.ReferenceCode ?? "";
|
||||
_transactionId = response.TransactionId;
|
||||
|
||||
// Wallet balances are no longer in verify response — show from purchase info
|
||||
if (response.PurchaseInfo != null)
|
||||
{
|
||||
_walletBalance = response.PurchaseInfo.AmountPaid;
|
||||
_discountBalance = 0; // Available in wallet page
|
||||
}
|
||||
|
||||
// اگر پرداخت موفق بود، توکن را refresh میکنیم
|
||||
// چون PackagePurchaseMethod تغییر کرده و باید در claims جدید باشد
|
||||
// اگر پرداخت موفق بود، موجودی واقعی کیف پول رو بگیر و توکن رو refresh کن
|
||||
if (_isSuccess)
|
||||
{
|
||||
try
|
||||
{
|
||||
var balances = await WalletService.GetBalancesAsync();
|
||||
_walletBalance = balances.CreditBalance;
|
||||
}
|
||||
catch { /* اگر خطا شد، صفر نمایش بده */ }
|
||||
|
||||
await RefreshTokenAsync();
|
||||
}
|
||||
}
|
||||
@@ -149,7 +144,7 @@
|
||||
|
||||
private void RetryPayment()
|
||||
{
|
||||
NavManager.NavigateTo("/profile");
|
||||
NavManager.NavigateTo("/profile", forceLoad: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -177,6 +172,4 @@
|
||||
}
|
||||
|
||||
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
|
||||
|
||||
private async Task GoBack() => await JS.InvokeVoidAsync("history.back");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user