From ed2b20a98e3b82e881d75ce5571314401339349e Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Fri, 27 Feb 2026 22:09:15 +0330 Subject: [PATCH] fix: wallet callback URL issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PaymentCallbackController: fix redirect paths /magic-wallet → /profile/magic-wallet - Add appsettings.Development.json with local CmsBaseUrl (localhost:32846) and FrontOfficeBaseUrl (localhost:5268) - Proto: fix comments ریال → تومان in wallet charge messages Root cause: CmsBaseUrl in appsettings.json points to stage (cms.se.kbs1.ir), so when testing locally, ZarinPal callback went to stage CMS instead of local. Also redirect after verify used wrong FO path (/magic-wallet instead of /profile/magic-wallet). --- .../Protos/userwallet.proto | 4 ++-- .../Controllers/PaymentCallbackController.cs | 6 +++--- .../appsettings.Development.json | 13 +++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 src/CMSMicroservice.WebApi/appsettings.Development.json diff --git a/src/CMSMicroservice.Protobuf/Protos/userwallet.proto b/src/CMSMicroservice.Protobuf/Protos/userwallet.proto index a48af72..dfb8593 100644 --- a/src/CMSMicroservice.Protobuf/Protos/userwallet.proto +++ b/src/CMSMicroservice.Protobuf/Protos/userwallet.proto @@ -231,7 +231,7 @@ message GetCustomerWithdrawalSettingsResponse message InitiateMagicChargeRequest { - int64 amount = 1; // مبلغ واریزی واقعی (ریال) + int64 amount = 1; // مبلغ واریزی (تومان) } message InitiateMagicChargeResponse @@ -259,7 +259,7 @@ message GetMagicWalletStatusResponse message InitiateDiscountChargeRequest { - int64 amount = 1; // مبلغ واریزی (ریال) + int64 amount = 1; // مبلغ واریزی (تومان) } message InitiateDiscountChargeResponse diff --git a/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs b/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs index 9898a31..bac9e5e 100644 --- a/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs +++ b/src/CMSMicroservice.WebApi/Controllers/PaymentCallbackController.cs @@ -166,7 +166,7 @@ public class PaymentCallbackController : ControllerBase if (string.IsNullOrEmpty(authority)) { _logger.LogError("Magic charge callback: Authority is missing"); - return Redirect($"{frontOfficeBaseUrl}/magic-wallet?payment=error&reason=no-authority"); + return Redirect($"{frontOfficeBaseUrl}/profile/magic-wallet?payment=error&reason=no-authority"); } var result = await _sender.Send(new VerifyMagicWalletChargeCommand @@ -179,12 +179,12 @@ public class PaymentCallbackController : ControllerBase "Magic charge completed successfully. Authority={Authority}", authority); - return Redirect($"{frontOfficeBaseUrl}/magic-wallet?payment=success"); + return Redirect($"{frontOfficeBaseUrl}/profile/magic-wallet?payment=success"); } catch (Exception ex) { _logger.LogError(ex, "Magic charge callback error. Authority={Authority}", authority); - return Redirect($"{frontOfficeBaseUrl}/magic-wallet?payment=failed"); + return Redirect($"{frontOfficeBaseUrl}/profile/magic-wallet?payment=failed"); } } diff --git a/src/CMSMicroservice.WebApi/appsettings.Development.json b/src/CMSMicroservice.WebApi/appsettings.Development.json new file mode 100644 index 0000000..df4f16b --- /dev/null +++ b/src/CMSMicroservice.WebApi/appsettings.Development.json @@ -0,0 +1,13 @@ +{ + "CmsBaseUrl": "https://localhost:32846", + "FrontOfficeBaseUrl": "http://localhost:5268", + "ZarinPal": { + "UseSandbox": true + }, + "Logging": { + "LogLevel": { + "Default": "Debug", + "Microsoft.AspNetCore": "Warning" + } + } +}