-
Notifications
You must be signed in to change notification settings - Fork 164
/
client.go
41 lines (29 loc) · 1.02 KB
/
client.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
33
34
35
36
37
38
39
40
41
package base
import (
"github.com/ArtisanCloud/PowerLibs/v2/object"
response2 "github.com/ArtisanCloud/PowerWeChat/v2/src/kernel/response"
"github.com/ArtisanCloud/PowerWeChat/v2/src/payment/kernel"
)
type Client struct {
*kernel.BaseClient
}
// 付款码支付
// https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10&index=1
func (comp *Client) Pay(params *object.StringMap) *response2.ResponseWork {
result := &response2.ResponseWork{}
endpoint := comp.Wrap("/v3/pay/micropay")
comp.Request(endpoint, params, "POST", nil, false, nil, result)
return result
}
// 付款码查询openid
// https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_13&index=9
func (comp *Client) AuthCodeToOpenID(authCode string) *response2.ResponseWork {
config := (*comp.App).GetConfig()
appID := config.GetString("app_id", "")
result := &response2.ResponseWork{}
comp.Request("tools/authcodetoopenid", &object.StringMap{
"appid": appID,
"auth_code": authCode,
}, "POST", nil, false, nil, result)
return result
}