fix(payment): update notification URL construction for gateway mode support
This commit is contained in:
parent
5d632608ab
commit
0e7cbf4396
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/perfect-panel/server/internal/report"
|
||||||
paymentPlatform "github.com/perfect-panel/server/pkg/payment"
|
paymentPlatform "github.com/perfect-panel/server/pkg/payment"
|
||||||
|
|
||||||
"github.com/perfect-panel/server/internal/model/payment"
|
"github.com/perfect-panel/server/internal/model/payment"
|
||||||
@ -43,15 +44,31 @@ func (l *GetPaymentMethodListLogic) GetPaymentMethodList(req *types.GetPaymentMe
|
|||||||
Total: total,
|
Total: total,
|
||||||
List: make([]types.PaymentMethodDetail, len(list)),
|
List: make([]types.PaymentMethodDetail, len(list)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gateway mod
|
||||||
|
|
||||||
|
isGatewayMod := report.IsGatewayMode()
|
||||||
|
|
||||||
for i, v := range list {
|
for i, v := range list {
|
||||||
config := make(map[string]interface{})
|
config := make(map[string]interface{})
|
||||||
_ = json.Unmarshal([]byte(v.Config), &config)
|
_ = json.Unmarshal([]byte(v.Config), &config)
|
||||||
notifyUrl := ""
|
notifyUrl := ""
|
||||||
|
|
||||||
if paymentPlatform.ParsePlatform(v.Platform) != paymentPlatform.Balance {
|
if paymentPlatform.ParsePlatform(v.Platform) != paymentPlatform.Balance {
|
||||||
|
notifyUrl = v.Domain
|
||||||
if 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 {
|
} 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{
|
resp.List[i] = types.PaymentMethodDetail{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user