ysf
This commit is contained in:
parent
c3c84f4519
commit
3913f00b13
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue