This commit is contained in:
李子铭 2024-12-10 16:03:53 +08:00
parent c3c84f4519
commit 3913f00b13
1 changed files with 8 additions and 0 deletions

View File

@ -31,14 +31,17 @@ func (s *AlipayRedPackService) Order(ctx context.Context, request *proto.OrderRe
if err != nil {
return nil, err
}
poReq, err := orderReq(request.Order, request.Product)
if err != nil {
return nil, proto.ErrorParamFail(err.Error())
}
param, err := c.paramReq(poReq, orderMethod)
if err != nil {
return nil, err
}
uv, err := req(c, param)
if err != nil {
return nil, err
@ -67,6 +70,7 @@ func (s *AlipayRedPackService) Query(ctx context.Context, request *proto.QueryRe
if err != nil {
return nil, err
}
uv, err := req(c, param)
if err != nil {
return nil, err
@ -90,18 +94,22 @@ func (s *AlipayRedPackService) Notify(_ context.Context, request *proto.NotifyRe
if err != nil {
return nil, err
}
n := notifyReq(request)
cert, err := alipay.GetCert(c.AppId)
if err != nil {
return nil, err
}
b, err := Verify(n, cert.PublicKey)
if err != nil {
return nil, proto.ErrorSignFail(err.Error())
}
if !b {
return nil, proto.ErrorSignFail("验签失败")
}
return notifyResp(n)
}