forked from smartwalle/alipay
/
info_type.go
49 lines (42 loc) · 1.02 KB
/
info_type.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
42
43
44
45
46
47
48
49
package alipay
// InfoReq 基本信息
type InfoReq struct {
AppAuthToken string `json:"-"`
}
// APIName 接口名字
func (c InfoReq) APIName() string {
return "alipay.open.public.info.query"
}
// Params 请求参数
func (c InfoReq) Params() map[string]string {
var m = make(map[string]string)
m["app_auth_token"] = c.AppAuthToken
return m
}
// ExtJSONParamName ext字段名字
func (c InfoReq) ExtJSONParamName() string {
return "biz_content"
}
// ExtJSONParamValue ext字段内容
func (c InfoReq) ExtJSONParamValue() string {
return marshal(c)
}
// InfoResp 请求响应
type InfoResp struct {
Body struct {
Code string `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
AppName string `json:"app_name"`
LogoURL string `json:"logo_url"`
} `json:"alipay_open_public_info_query_response"`
Sign string `json:"sign"`
}
// IsSuccess 返回是否成功
func (c *InfoResp) IsSuccess() bool {
if c.Body.Code == K_SUCCESS_CODE {
return true
}
return false
}