35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"linkpay/internal/service"
|
|
|
|
"git.linkiio.cn/linkpay/protobuf"
|
|
)
|
|
|
|
/**
|
|
* 回调事件实现
|
|
* @author dc.To
|
|
* @version 20250418
|
|
*/
|
|
func Event(ctx context.Context, req *protobuf.EventReq) (res *protobuf.EventRes, err error) {
|
|
|
|
res = &protobuf.EventRes{
|
|
Type: "order",
|
|
Data: &protobuf.EventRes_Order{
|
|
Order: &protobuf.Orders{
|
|
Kid: req.Kid, //商户ID
|
|
Uid: req.Uid, //用户ID
|
|
Org: req.Org, //商户名称
|
|
Via: req.Via, //支付渠道
|
|
OrgNo: "12345", //渠道订单号
|
|
OrderNo: "67890", //商户订单号
|
|
Response: string(req.GetBody()), //解签后的Body数据
|
|
State: int32(service.GetState("error")), //订单状态 (参考 protobuf.State 枚举 @see https://git.linkiio.cn/linkpay/protobuf/src/commit/982698cc1cf9d050d21f904563b5403d1f11d987/org.pb.go#L26)
|
|
StateText: "支付失败", //渠道方状态原因,状态说明
|
|
},
|
|
},
|
|
}
|
|
return
|
|
}
|