This commit is contained in:
邹宗楠
2025-04-29 14:42:24 +08:00
parent 9da5d239c6
commit c248d8e1d1
5 changed files with 41 additions and 8 deletions

View File

@@ -153,6 +153,30 @@ type AddTermReq struct {
Sign string `json:"sign"`
}
// TLQueryTerm 采集门店终端设备信息查询
func (a *API) TLQueryTerm(param *AddTermQuery) error {
onlineReq := utils.Struct2Map(param, "", false)
result, err := a.AccessAPI2("https://vsp.allinpay.com/cusapi/merchantapi/qryterm", onlineReq)
if err != nil {
return err
}
if result["retcode"].(string) != "SUCCESS" {
return fmt.Errorf(result["retmsg"].(string))
}
return nil
}
type AddTermQuery struct {
Orgid string `json:"orgid"` // 集团/代理商商户号 是 共享集团号/代理商参数时必填
Cusid string `json:"cusid"` // 商户号实际交易的商户号 否
Appid string `json:"appid"` // 应用ID平台分配的APPID 否
Version string `json:"version"` // 版本号接口版本号 可
Termno string `json:"termno"` // 8位数字,商户下唯一 否
Signtype string `json:"signtype"`
Sign string `json:"sign"`
Querytype string `json:"querytype"`
}
func (a *API) AccessAPI2(action string, bizParams map[string]interface{}) (retVal map[string]interface{}, err error) {
params := make(map[string]interface{})
params["appid"] = a.appID

View File

@@ -102,9 +102,9 @@ func TestOrderRefund(t *testing.T) {
func TestTLAddTerm(t *testing.T) {
param := &AddTermReq{
Termno: fmt.Sprintf("%d_1", 668470),
Devicetype: "10",
Termsn: fmt.Sprintf("%d_1", 668470),
Termno: fmt.Sprintf("%d00", 668470),
Devicetype: "11",
Termsn: fmt.Sprintf("%d00", 668470),
Operation: "00",
Termstate: "",
Termaddress: fmt.Sprintf("%s-%s-%s-%s", "四川省", "成都市", "金牛区", "圃圆小筑"),
@@ -115,3 +115,12 @@ func TestTLAddTerm(t *testing.T) {
api.TLAddTerm(param)
}
func TestTLTLQueryTerm(t *testing.T) {
param := &AddTermQuery{
Termno: "66847000",
Signtype: "RSA",
Sign: "",
}
api.TLQueryTerm(param)
}