From 8ba557f49341dadbecd8971173d084d95420e30d Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Wed, 5 Jun 2024 10:52:59 +0800 Subject: [PATCH] add applepay_callback --- app/mix/controller/applepay_callback.go | 23 +++++++++++++++++++++++ app/mix/controller/init.go | 1 + 2 files changed, 24 insertions(+) create mode 100644 app/mix/controller/applepay_callback.go diff --git a/app/mix/controller/applepay_callback.go b/app/mix/controller/applepay_callback.go new file mode 100644 index 00000000..acbab2db --- /dev/null +++ b/app/mix/controller/applepay_callback.go @@ -0,0 +1,23 @@ +package controller + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + "io/ioutil" + "net/http" + "service/bizcommon/util" + "service/library/logger" +) + +func ApplepayCallback(ctx *gin.Context) { + var bodyParam map[string]interface{} + buf, err := ioutil.ReadAll(ctx.Request.Body) + logger.Info("ApplepayCallback body: %v", string(buf)) + err = json.Unmarshal(buf, &bodyParam) + if err != nil { + logger.Error("arg parse fail: %v", err) + ReplyJsonError(ctx, http.StatusBadRequest, "参数解析失败") + return + } + logger.Info("ApplepayCallback param: %v", util.ToJson(bodyParam)) +} diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index f27a5bcf..711f0c12 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -294,6 +294,7 @@ func Init(r *gin.Engine) { extVasPayGroup := r.Group("/ext/vas") extVasPayGroup.POST("alipay_callback", AlipayCallback) extVasPayGroup.POST("wxpay_callback", WxpayCallback) + extVasPayGroup.POST("applepay_callback", ApplepayCallback) opVasPayGroup := r.Group("/op/vas", PrepareOp()) opVasPayGroup.POST("create_order", middleware.JSONParamValidator(vasproto.OpCreateOrderReq{}), OpCreateOrder)