This commit is contained in:
邹宗楠
2023-05-19 17:21:17 +08:00
parent d6ea1e8bd7
commit 0c024e20e0
5 changed files with 71 additions and 66 deletions

View File

@@ -26,20 +26,20 @@ type GetAutoTokenRes struct {
// PreCreateOrderReq 快手预发单
type PreCreateOrderReq struct {
OutOrderNo string `json:"out_order_no"` // 商户系统内部订单号只能是数字、大小写字母_-*且在同一个商户号下唯一
OpenId string `json:"open_id"` // 快手用户在当前小程序的open_id
TotalAmount int64 `json:"total_amount"` // 用户支付金额,单位为[分]。
Subject string `json:"subject"` // 商品描述。注1汉字=2字符。
Detail string `json:"detail"` // 商品详情。注1汉字=2字符。
TypeDetail int `json:"type"` // 商品类型,不同商品类目的编号见
ExpireTime int `json:"expire_time"` // 订单过期时间,单位秒
Sign string `json:"sign"` // 签名
Attach string `json:"attach"` // 开发者自定义字段,回调原样回传.
NotifyUrl string `json:"notify_url"` // 回调地址
GoodsId string `json:"goods_id"` // 下单商品id需与商品对接 (opens new window)时的product_id一致长度限制256个英文字符1个汉字=2个英文字符
GoodsDetailUrl string `json:"goods_detail_url"` // 订单详情页跳转path。
MultiCopiesGoodsInfo string `json:"multi_copies_goods_info"` // 单商品购买多份场景 "[{"copies":2}]"
CancelOrder int64 `json:"cancel_order"` // 该字段表示创建订单的同时是否覆盖之前已存在的订单。
OutOrderNo string `json:"out_order_no"` // 商户系统内部订单号只能是数字、大小写字母_-*且在同一个商户号下唯一
OpenId string `json:"open_id"` // 快手用户在当前小程序的open_id
TotalAmount int64 `json:"total_amount"` // 用户支付金额,单位为[分]。
Subject string `json:"subject"` // 商品描述。注1汉字=2字符。
Detail string `json:"detail"` // 商品详情。注1汉字=2字符。
TypeDetail int `json:"type"` // 商品类型,不同商品类目的编号见
ExpireTime int `json:"expire_time"` // 订单过期时间,单位秒
Sign string `json:"sign"` // 签名
//Attach string `json:"attach"` // 开发者自定义字段,回调原样回传.
NotifyUrl string `json:"notify_url"` // 回调地址
//GoodsId string `json:"goods_id"` // 下单商品id需与商品对接 (opens new window)时的product_id一致长度限制256个英文字符1个汉字=2个英文字符
//GoodsDetailUrl string `json:"goods_detail_url"` // 订单详情页跳转path。
//MultiCopiesGoodsInfo string `json:"multi_copies_goods_info"` // 单商品购买多份场景 "[{"copies":2}]"
CancelOrder int64 `json:"cancel_order"` // 该字段表示创建订单的同时是否覆盖之前已存在的订单。
}
// PreCreateOrderResponse 预下单返回参数

View File

@@ -72,20 +72,20 @@ func TestCreateToken(t *testing.T) {
// 快手预下单获取支付参数
func TestPreCreateOrder(t *testing.T) {
param := &PreCreateOrderReq{
OutOrderNo: "1024028220",
OpenId: "f198f59711c9785314bf5724f7ab9f47",
TotalAmount: 1,
Subject: "这是一个测试商品",
Detail: "大白菜,小白菜,中白菜",
TypeDetail: 1832, // 素菜
ExpireTime: 10 * 60,
Sign: "",
Attach: "1111",
NotifyUrl: "https://callback.jxc4.com/tictoc/tiktokMsg",
GoodsId: "1122",
GoodsDetailUrl: "/page/index/anima",
MultiCopiesGoodsInfo: "[{\"copies\":2}]",
CancelOrder: 0,
OutOrderNo: "88422209072664",
OpenId: "f198f59711c9785314bf5724f7ab9f47",
TotalAmount: 501,
Subject: "蔬菜水果日用品",
Detail: "收藏门店 赠送随机小惊喜一份1g/个 x 1件商品",
TypeDetail: 1832, // 素菜
ExpireTime: 10 * 60,
Sign: "",
//Attach: "22",
NotifyUrl: "https://callback-jxgy.jxc4.com/kuaishou/kuaiShouCallback",
//GoodsId: "1122",
//GoodsDetailUrl: "/page/index/anima",
//MultiCopiesGoodsInfo: `[{"copies":2}]`,
CancelOrder: 1,
}
data, err := api.PreCreateOrder(param)
globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false))