Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoogle-ink committed Dec 24, 2024
1 parent b42e015 commit 5248cfa
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions wechat/v3/palm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,22 @@ func (c *ClientV3) V3PalmServicePreAuthorize(ctx context.Context, bm gopay.BodyM
if err != nil {
return nil, err
}
wxRsp = &PalmServicePreAuthorizeRsp{Code: Success, SignInfo: si}
wxRsp.Response = new(PalmServicePreAuthorize)
if err = json.Unmarshal(bs, wxRsp.Response); err != nil {
return nil, fmt.Errorf("[%w]: %v, bytes: %s", gopay.UnmarshalErr, err, string(bs))
}
wxRsp = &PalmServicePreAuthorizeRsp{Code: Success, SignInfo: si, Response: &PalmServicePreAuthorize{}}
if res.StatusCode != http.StatusOK {
wxRsp.Code = res.StatusCode
wxRsp.Error = string(bs)
return wxRsp, nil
}
if err = json.Unmarshal(bs, wxRsp.Response); err != nil {
return nil, fmt.Errorf("[%w]: %v, bytes: %s", gopay.UnmarshalErr, err, string(bs))
}
return wxRsp, c.verifySyncSign(si)
}

// 预授权状态查询
// Code = 0 is success
func (c *ClientV3) V3PalmServiceOpenidQuery(ctx context.Context, openid, organizationId string) (wxRsp *PalmServiceOpenidQueryRsp, err error) {
uri := fmt.Sprintf(v3PalmServiceOpenidQuery, openid) + "?organization_id=" + organizationId
func (c *ClientV3) V3PalmServiceOpenidQuery(ctx context.Context, openid string, bm gopay.BodyMap) (wxRsp *PalmServiceOpenidQueryRsp, err error) {
uri := fmt.Sprintf(v3PalmServiceOpenidQuery, openid) + "?" + bm.EncodeURLParams()
authorization, err := c.authorization(MethodGet, uri, nil)
if err != nil {
return nil, err
Expand All @@ -45,15 +44,14 @@ func (c *ClientV3) V3PalmServiceOpenidQuery(ctx context.Context, openid, organiz
if err != nil {
return nil, err
}
wxRsp = &PalmServiceOpenidQueryRsp{Code: Success, SignInfo: si}
wxRsp.Response = new(PalmServiceOpenidQuery)
if err = json.Unmarshal(bs, wxRsp.Response); err != nil {
return nil, fmt.Errorf("[%w]: %v, bytes: %s", gopay.UnmarshalErr, err, string(bs))
}
wxRsp = &PalmServiceOpenidQueryRsp{Code: Success, SignInfo: si, Response: &PalmServiceOpenidQuery{}}
if res.StatusCode != http.StatusOK {
wxRsp.Code = res.StatusCode
wxRsp.Error = string(bs)
return wxRsp, nil
}
if err = json.Unmarshal(bs, wxRsp.Response); err != nil {
return nil, fmt.Errorf("[%w]: %v, bytes: %s", gopay.UnmarshalErr, err, string(bs))
}
return wxRsp, c.verifySyncSign(si)
}

0 comments on commit 5248cfa

Please sign in to comment.