From 0e7cbf439641eb5efc04feff8786f1a108c787f8 Mon Sep 17 00:00:00 2001 From: Tension Date: Mon, 8 Dec 2025 16:09:21 +0800 Subject: [PATCH] fix(payment): update notification URL construction for gateway mode support --- .../payment/getPaymentMethodListLogic.go | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/internal/logic/admin/payment/getPaymentMethodListLogic.go b/internal/logic/admin/payment/getPaymentMethodListLogic.go index 77c7e40..ef987f3 100644 --- a/internal/logic/admin/payment/getPaymentMethodListLogic.go +++ b/internal/logic/admin/payment/getPaymentMethodListLogic.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" + "github.com/perfect-panel/server/internal/report" paymentPlatform "github.com/perfect-panel/server/pkg/payment" "github.com/perfect-panel/server/internal/model/payment" @@ -43,15 +44,31 @@ func (l *GetPaymentMethodListLogic) GetPaymentMethodList(req *types.GetPaymentMe Total: total, List: make([]types.PaymentMethodDetail, len(list)), } + + // gateway mod + + isGatewayMod := report.IsGatewayMode() + for i, v := range list { config := make(map[string]interface{}) _ = json.Unmarshal([]byte(v.Config), &config) notifyUrl := "" + if paymentPlatform.ParsePlatform(v.Platform) != paymentPlatform.Balance { + notifyUrl = v.Domain if v.Domain != "" { - notifyUrl = v.Domain + "/v1/notify/" + v.Platform + "/" + v.Token + // if is gateway mod, use gateway domain + if isGatewayMod { + notifyUrl += "/api/" + } + notifyUrl += "/v1/notify/" + v.Platform + "/" + v.Token } else { - notifyUrl = "https://" + l.svcCtx.Config.Host + "/v1/notify/" + v.Platform + "/" + v.Token + notifyUrl += "https://" + l.svcCtx.Config.Host + if isGatewayMod { + notifyUrl += "/api/v1/notify/" + v.Platform + "/" + v.Token + } else { + notifyUrl += "/v1/notify/" + v.Platform + "/" + v.Token + } } } resp.List[i] = types.PaymentMethodDetail{