fix: 修复富友预下单报文格式错(1014) — XML根元素、小程序tradeType、termIP三处问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m27s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m27s
This commit is contained in:
@@ -202,6 +202,12 @@ func structToMap(data interface{}) map[string]string {
|
||||
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
field := t.Field(i)
|
||||
|
||||
// 排除 XMLName 字段(xml.Name 类型,仅用于指定根元素名称)
|
||||
if field.Name == "XMLName" {
|
||||
continue
|
||||
}
|
||||
|
||||
value := v.Field(i).String()
|
||||
|
||||
tag := field.Tag.Get("xml")
|
||||
|
||||
@@ -2,23 +2,26 @@
|
||||
// 实现富友 wxPreCreate 接口的签名、通信和回调处理
|
||||
package fuiou
|
||||
|
||||
import "encoding/xml"
|
||||
|
||||
// WxPreCreateRequest wxPreCreate 下单请求
|
||||
type WxPreCreateRequest struct {
|
||||
Version string `xml:"version"` // 版本号: 1.0
|
||||
InsCd string `xml:"ins_cd"` // 机构号
|
||||
MchntCd string `xml:"mchnt_cd"` // 商户号
|
||||
TermId string `xml:"term_id"` // 终端号
|
||||
RandomStr string `xml:"random_str"` // 随机字符串
|
||||
Sign string `xml:"sign"` // 签名
|
||||
MchntOrderNo string `xml:"mchnt_order_no"` // 商户订单号
|
||||
TradeType string `xml:"trade_type"` // 交易类型: JSAPI=公众号 LETPAY=小程序
|
||||
OrderAmt string `xml:"order_amt"` // 订单金额(分)
|
||||
GoodsDesc string `xml:"goods_des"` // 商品描述
|
||||
TermIp string `xml:"term_ip"` // 终端IP
|
||||
NotifyUrl string `xml:"notify_url"` // 回调地址
|
||||
SubAppid string `xml:"sub_appid"` // 子应用ID(公众号/小程序AppID)
|
||||
SubOpenid string `xml:"sub_openid"` // 用户OpenID
|
||||
LimitPay string `xml:"limit_pay"` // 限制支付方式(可选)
|
||||
XMLName xml.Name `xml:"xml"`
|
||||
Version string `xml:"version"` // 版本号: 1.0
|
||||
InsCd string `xml:"ins_cd"` // 机构号
|
||||
MchntCd string `xml:"mchnt_cd"` // 商户号
|
||||
TermId string `xml:"term_id"` // 终端号
|
||||
RandomStr string `xml:"random_str"` // 随机字符串
|
||||
Sign string `xml:"sign"` // 签名
|
||||
MchntOrderNo string `xml:"mchnt_order_no"` // 商户订单号
|
||||
TradeType string `xml:"trade_type"` // 交易类型: JSAPI=公众号 LETPAY=小程序
|
||||
OrderAmt string `xml:"order_amt"` // 订单金额(分)
|
||||
GoodsDesc string `xml:"goods_des"` // 商品描述
|
||||
TermIp string `xml:"term_ip"` // 终端IP
|
||||
NotifyUrl string `xml:"notify_url"` // 回调地址
|
||||
SubAppid string `xml:"sub_appid"` // 子应用ID(公众号/小程序AppID)
|
||||
SubOpenid string `xml:"sub_openid"` // 用户OpenID
|
||||
LimitPay string `xml:"limit_pay"` // 限制支付方式(可选)
|
||||
}
|
||||
|
||||
// WxPreCreateResponse wxPreCreate 下单响应
|
||||
|
||||
Reference in New Issue
Block a user