1
This commit is contained in:
@@ -35,10 +35,14 @@ 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` // 添加设备终端
|
||||
)
|
||||
|
||||
const (
|
||||
EncryptionRsa = "RSA" // 加密方式
|
||||
EncryptionRsa = "RSA" // 加密方式
|
||||
ScannerOperrationStart = "00" // 扫码枪本次操作类型-新增
|
||||
ScannerOperrationLogOff = "02" // 扫码枪本次操作类型-注销
|
||||
ScannerOperrationUpdate = "01" // 扫码枪本次操作类型-修改
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -120,6 +124,35 @@ func (a *API) OrderRefund(param *OnLineOrderRefundParam) (statusCode, errRemake
|
||||
return payInfo.Trxstatus, payInfo.Errmsg, nil
|
||||
}
|
||||
|
||||
// TLAddTerm 采集门店终端设备信息
|
||||
func (a *API) TLAddTerm(param *AddTermReq) error {
|
||||
onlineReq := utils.Struct2Map(param, "", false)
|
||||
result, err := a.AccessAPI2(OnLineAddterm, onlineReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if result["retcode"].(string) != "SUCCESS" {
|
||||
return fmt.Errorf(result["retmsg"].(string))
|
||||
}
|
||||
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"`
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user