This commit is contained in:
2025-04-27 12:17:18 +08:00
parent b60f6ffb3e
commit 2aea96db2c
128 changed files with 396 additions and 222 deletions

View File

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

View File

@@ -0,0 +1,30 @@
package pay
import (
"net/http"
"tyc-server/app/main/api/internal/logic/pay"
"tyc-server/app/main/api/internal/svc"
"tyc-server/app/main/api/internal/types"
"tyc-server/common/result"
"tyc-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func IapCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.IapCallbackReq
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.NewIapCallbackLogic(r.Context(), svcCtx)
err := l.IapCallback(&req)
result.HttpResult(r, w, nil, err)
}
}

View File

@@ -0,0 +1,30 @@
package pay
import (
"net/http"
"tyc-server/app/main/api/internal/logic/pay"
"tyc-server/app/main/api/internal/svc"
"tyc-server/app/main/api/internal/types"
"tyc-server/common/result"
"tyc-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func PaymentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.PaymentReq
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.NewPaymentLogic(r.Context(), svcCtx)
resp, err := l.Payment(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

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

View File

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