diff --git a/src/FrontOffice.Main/Pages/Profile/PaymentCallback.razor b/src/FrontOffice.Main/Pages/Profile/PaymentCallback.razor
index 7f2785d..20edafd 100644
--- a/src/FrontOffice.Main/Pages/Profile/PaymentCallback.razor
+++ b/src/FrontOffice.Main/Pages/Profile/PaymentCallback.razor
@@ -3,7 +3,7 @@
@using Blazored.LocalStorage
@using CMSMicroservice.Protobuf.Protos.Package
@using CMSMicroservice.Protobuf.Protos.User
-@inject IJSRuntime JS
+@using FrontOffice.Main.Utilities
نتیجه پرداخت | کارا بازار سلامت
@@ -21,24 +21,21 @@
پرداخت موفق
@_message
- @if (!string.IsNullOrEmpty(_refId))
+ @if (_transactionId > 0)
{
- کد پیگیری: @_refId
+ کد ارجاعی: @_transactionId
}
- موجودی کیف پول اصلی: @FormatPrice(_walletBalance)
-
-
- موجودی کیف پول اعتباری: @FormatPrice(_discountBalance)
+ موجودی کیف پول: @FormatPrice(_walletBalance)
+ Href="/profile">
بازگشت به پروفایل
}
@@ -49,7 +46,7 @@
@_message
+ Href="/profile">
بازگشت به پروفایل
@@ -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);
}
///
@@ -177,6 +172,4 @@
}
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
-
- private async Task GoBack() => await JS.InvokeVoidAsync("history.back");
}