This commit is contained in:
2026-01-16 17:01:36 +08:00
parent 23ad0477b2
commit 663ad1af0d
8 changed files with 600 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
package pay
import (
"net/http"
"jnc-server/app/main/api/internal/logic/pay"
"jnc-server/app/main/api/internal/svc"
"jnc-server/common/result"
)
func YunYinSignPayCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := pay.NewYunYinSignPayCallbackLogic(r.Context(), svcCtx)
err := l.YunYinSignPayCallback(w, r)
result.HttpResult(r, w, nil, err)
}
}

View File

@@ -0,0 +1,30 @@
package pay
import (
"net/http"
"jnc-server/app/main/api/internal/logic/pay"
"jnc-server/app/main/api/internal/svc"
"jnc-server/app/main/api/internal/types"
"jnc-server/common/result"
"jnc-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func YunYinSignPayRefundHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.YunYinSignPayRefundReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
if err := validator.Validate(req); err != nil {
result.ParamValidateErrorResult(r, w, err)
return
}
l := pay.NewYunYinSignPayRefundLogic(r.Context(), svcCtx)
resp, err := l.YunYinSignPayRefund(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -786,6 +786,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/pay/wechat/refund_callback",
Handler: pay.WechatPayRefundCallbackHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/yunyinsign/callback",
Handler: pay.YunYinSignPayCallbackHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
@@ -809,6 +814,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/pay/payment",
Handler: pay.PaymentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/pay/yunyinsign/refund",
Handler: pay.YunYinSignPayRefundHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),