Skip to content

Commit

Permalink
增加掌纹支付预授权查询接口
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoogle-ink committed Dec 2, 2024
1 parent 2ce1ecb commit 0c20bac
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
14 changes: 14 additions & 0 deletions wechat/v3/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ type PalmServicePreAuthorizeRsp struct {
Error string `json:"-"`
}

type PalmServiceOpenidQueryRsp struct {
Code int `json:"-"`
SignInfo *SignInfo `json:"-"`
Response *PalmServiceOpenidQuery `json:"response,omitempty"`
Error string `json:"-"`
}

// =========================================================分割=========================================================

type JSAPIPayParams struct {
Expand Down Expand Up @@ -310,3 +317,10 @@ type WithdrawStatus struct {
type PalmServicePreAuthorize struct {
PermissionToken string `json:"permission_token"` // 预授权token,跳转小程序使用
}

type PalmServiceOpenidQuery struct {
OrganizationId string `json:"organization_id"`
Openid string `json:"openid"`
State string `json:"state"`
AuthorizeTime string `json:"authorize_time"`
}
21 changes: 21 additions & 0 deletions wechat/v3/palm.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,24 @@ func (c *ClientV3) V3PalmServicePreAuthorize(ctx context.Context, bm gopay.BodyM
}
return wxRsp, c.verifySyncSign(si)
}

// 预授权状态查询
// Code = 0 is success
func (c *ClientV3) V3PalmServiceOpenidQuery(ctx context.Context, bm gopay.BodyMap) (wxRsp *PalmServiceOpenidQueryRsp, err error) {
uri := v3PalmServiceOpenidQuery + "?" + bm.EncodeURLParams()
authorization, err := c.authorization(MethodGet, uri, nil)
if err != nil {
return nil, err
}
res, si, bs, err := c.doProdGet(ctx, uri, authorization)
if err != nil {
return nil, err
}
wxRsp = &PalmServiceOpenidQueryRsp{Code: Success, SignInfo: si}
if res.StatusCode != http.StatusOK {
wxRsp.Code = res.StatusCode
wxRsp.Error = string(bs)
return wxRsp, nil
}
return wxRsp, c.verifySyncSign(si)
}

0 comments on commit 0c20bac

Please sign in to comment.