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