service/app/mix/controller/alipay_callback.go

28 lines
727 B
Go

package controller
import (
"github.com/gin-gonic/gin"
vasproto "service/api/proto/vas/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/payclients/alipaycli"
)
func AlipayCallback(ctx *gin.Context) {
bm, err := alipaycli.ParseNotify(ctx.Request)
if err != nil {
logger.Error("ParseNotify fail, req: %v, err: %v", util.ToJson(bm), err)
return
}
if bm.GetString("trade_status") == "TRADE_SUCCESS" {
_ = service.DefaultService.PayCallback(ctx, &vasproto.PayCallbackParamIn{
OrderId: bm.GetString("out_trade_no"),
OutOrderId: bm.GetString("trade_no"),
CallbackPayType: vasproto.CallBackPayTypeAlipay,
})
}
ctx.String(200, "success")
}