You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
package leshuazf
|
|
|
|
import (
|
|
"context"
|
|
"github.com/dtapps/go-library/utils/gojson"
|
|
"github.com/dtapps/go-library/utils/gorequest"
|
|
"net/http"
|
|
)
|
|
|
|
type DataMccResponse struct {
|
|
RespCode string `json:"respCode"`
|
|
RespMsg string `json:"respMsg"`
|
|
ReqSerialNo string `json:"reqSerialNo"`
|
|
Data []struct {
|
|
GrandpaCode string `json:"grandpaCode"`
|
|
GrandpaText string `json:"grandpaText"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
type DataMccResult struct {
|
|
Result DataMccResponse // 结果
|
|
Body []byte // 内容
|
|
Http gorequest.Response // 请求
|
|
Err error // 错误
|
|
}
|
|
|
|
func newDataMccResult(result DataMccResponse, body []byte, http gorequest.Response, err error) *DataMccResult {
|
|
return &DataMccResult{Result: result, Body: body, Http: http, Err: err}
|
|
}
|
|
|
|
// DataMcc 代理商通过MccCode来查商户类别明细
|
|
// https://www.yuque.com/leshuazf/doc/dbmxyi#jRTHN
|
|
func (c *Client) DataMcc(ctx context.Context, notMustParams ...gorequest.Params) *DataMccResult {
|
|
// 参数
|
|
params := gorequest.NewParamsWith(notMustParams...)
|
|
// 请求
|
|
request, err := c.request(ctx, "/data/mcc", params, http.MethodPost)
|
|
// 定义
|
|
var response DataMccResponse
|
|
err = gojson.Unmarshal(request.ResponseBody, &response)
|
|
return newDataMccResult(response, request.ResponseBody, request, err)
|
|
}
|