From 5ded91a58a0d9eaf773979a0d615bee97839e014 Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Fri, 27 Feb 2026 21:31:45 +0330 Subject: [PATCH] =?UTF-8?q?fix:=20payment=20success=20page=20=E2=80=94=20s?= =?UTF-8?q?how=20TransactionId,=20real=20wallet=20balance,=20fix=20back=20?= =?UTF-8?q?button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - کد ارجاعی: از TransactionId جدول تراکنش‌ها بجای RefId زرین‌پال - موجودی: از WalletService.GetBalancesAsync() موجودی واقعی کیف پول اصلی - حذف نمایش موجودی کیف پول اعتباری (نیازی نیست) - دکمه بازگشت: Href=/profile بجای history.back() (که به درگاه می‌رفت) --- .../Pages/Profile/PaymentCallback.razor | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) 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"); }