service/app/mix/controller/alipay_callback.go

27 lines
722 B
Go
Raw Normal View History

2023-12-29 14:16:37 +08:00
package controller
import (
"github.com/gin-gonic/gin"
vasproto "service/api/proto/vas/proto"
"service/app/mix/service"
2023-12-29 17:40:33 +08:00
"service/bizcommon/util"
2023-12-29 14:16:37 +08:00
"service/library/logger"
"service/library/payclients/alipaycli"
)
func AlipayCallback(ctx *gin.Context) {
2023-12-29 17:40:33 +08:00
//req, _ := ctx.GetRawData()
//logger.Info("_AlipayCallback req: %v", string(req))
2023-12-29 14:16:37 +08:00
bm, err := alipaycli.GetDefaultAlipayClient().ParseNotify(ctx.Request)
if err != nil {
2023-12-29 17:40:33 +08:00
logger.Error("ParseNotify fail, req: %v, err: %v", util.ToJson(bm), err)
2023-12-29 14:16:37 +08:00
return
}
service.DefaultService.AlipayCallback(ctx, &vasproto.AlipayCallbackParamIn{
OrderId: bm.GetString("out_trade_no"),
AlipayOrderId: bm.GetString("trade_no"),
})
ctx.String(200, "success")
}