forked from go-pay/gopay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
third_dev.go
32 lines (29 loc) · 1008 Bytes
/
third_dev.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package alipay
import (
"context"
"encoding/json"
"fmt"
"github.com/SuperH-0630/gopay"
)
// alipay.open.app.api.query(查询应用可申请的接口出参敏感字段列表)
// 文档地址:https://opendocs.alipay.com/isv/04f74n
func (a *Client) OpenAppApiQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *OpenAppApiQueryResponse, err error) {
err = bm.CheckEmptyError("app_auth_token")
if err != nil {
return nil, err
}
var bs []byte
if bs, err = a.doAliPay(ctx, bm, "alipay.open.app.api.query"); err != nil {
return nil, err
}
aliRsp = new(OpenAppApiQueryResponse)
if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil {
return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs))
}
if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil {
return aliRsp, err
}
signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn)
aliRsp.SignData = signData
return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr)
}