1
This commit is contained in:
@@ -280,3 +280,32 @@ type OnLineOrderRefundResult struct {
|
||||
Bankcode string `json:"bankcode"` // 所属银行
|
||||
Sign string `json:"sign"` // 签名
|
||||
}
|
||||
|
||||
// AddTermReq 添加采集设备
|
||||
type AddTermReq struct {
|
||||
Orgid string `json:"orgid"` // 集团/代理商商户号 是 共享集团号/代理商参数时必填
|
||||
Cusid string `json:"cusid"` // 商户号实际交易的商户号 否
|
||||
Appid string `json:"appid"` // 应用ID平台分配的APPID 否
|
||||
Version string `json:"version"` // 版本号接口版本号 可
|
||||
|
||||
Termno string `json:"termno"` // 8位数字,商户下唯一 否
|
||||
Devicetype string `json:"devicetype"` // 设备类型 否
|
||||
Termsn string `json:"termsn"` // 终端序列号 终端类型(device_type)填写为 02、03、04、05、06、08、09 或 10时,必须填写终端序列号。
|
||||
Operation string `json:"operation"` // 本次操作标识,取值范围:00:新增;01:修改;02:注销;(注销时,仅需上送termno字段)
|
||||
Termstate string `json:"termstate"` // 取值范围:00:启用;01:注销;注:终端注销时非必填
|
||||
Termaddress string `json:"termaddress"` // 终端地址
|
||||
Signtype string `json:"signtype"`
|
||||
Sign string `json:"sign"`
|
||||
}
|
||||
|
||||
// AddTermQuery 采集设备查询
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ const (
|
||||
OnlinePayUrl = `https://vsp.allinpay.com/apiweb/unitorder/scanqrpay` // 扫码支付
|
||||
OnLineTransactionQuery = `https://vsp.allinpay.com/apiweb/tranx/query` // 交易查询,查询订单的支付状态
|
||||
OnLineRefund = `https://vsp.allinpay.com/apiweb/tranx/refund` // 同一退款接口
|
||||
OnLineAddterm = `https://vsp.allinpay.com/cusapi/merchantapi/addterm` // 添加设备终端
|
||||
OnLineAddTerm = `https://vsp.allinpay.com/cusapi/merchantapi/addterm` // 添加设备终端
|
||||
OnLineQuerYTerm = `https://vsp.allinpay.com/cusapi/merchantapi/qryterm` // 查询设备终端
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -127,7 +128,7 @@ func (a *API) OrderRefund(param *OnLineOrderRefundParam) (statusCode, errRemake
|
||||
// TLAddTerm 采集门店终端设备信息
|
||||
func (a *API) TLAddTerm(param *AddTermReq) error {
|
||||
onlineReq := utils.Struct2Map(param, "", false)
|
||||
result, err := a.AccessAPI2(OnLineAddterm, onlineReq)
|
||||
result, err := a.AccessAPI2(OnLineAddTerm, onlineReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -137,51 +138,24 @@ func (a *API) TLAddTerm(param *AddTermReq) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AddTermReq struct {
|
||||
Orgid string `json:"orgid"` // 集团/代理商商户号 是 共享集团号/代理商参数时必填
|
||||
Cusid string `json:"cusid"` // 商户号实际交易的商户号 否
|
||||
Appid string `json:"appid"` // 应用ID平台分配的APPID 否
|
||||
Version string `json:"version"` // 版本号接口版本号 可
|
||||
|
||||
Termno string `json:"termno"` // 8位数字,商户下唯一 否
|
||||
Devicetype string `json:"devicetype"` // 设备类型 否
|
||||
Termsn string `json:"termsn"` // 终端序列号 终端类型(device_type)填写为 02、03、04、05、06、08、09 或 10时,必须填写终端序列号。
|
||||
Operation string `json:"operation"` // 本次操作标识,取值范围:00:新增;01:修改;02:注销;(注销时,仅需上送termno字段)
|
||||
Termstate string `json:"termstate"` // 取值范围:00:启用;01:注销;注:终端注销时非必填
|
||||
Termaddress string `json:"termaddress"` // 终端地址
|
||||
Signtype string `json:"signtype"`
|
||||
Sign string `json:"sign"`
|
||||
}
|
||||
|
||||
// TLQueryTerm 采集门店终端设备信息查询
|
||||
func (a *API) TLQueryTerm(param *AddTermQuery) error {
|
||||
func (a *API) TLQueryTerm(param *AddTermQuery) (string, error) {
|
||||
onlineReq := utils.Struct2Map(param, "", false)
|
||||
result, err := a.AccessAPI2("https://vsp.allinpay.com/cusapi/merchantapi/qryterm", onlineReq)
|
||||
result, err := a.AccessAPI2(OnLineQuerYTerm, onlineReq)
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
if result["retcode"].(string) != "SUCCESS" {
|
||||
return fmt.Errorf(result["retmsg"].(string))
|
||||
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"`
|
||||
return fmt.Sprintf("微信报备:%s,阿里报备:%s", result["wxmsg"].(string), result["almsg"].(string)), nil
|
||||
}
|
||||
|
||||
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
|
||||
params["cusid"] = a.cusID
|
||||
if action != OnLineAddterm {
|
||||
if action != OnLineAddTerm {
|
||||
params["randomstr"] = utils.GetUUID()
|
||||
}
|
||||
params["version"] = "12"
|
||||
|
||||
Reference in New Issue
Block a user