1
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
package dadaapi
|
package dadaapi
|
||||||
|
|
||||||
import "go.uber.org/zap"
|
import (
|
||||||
|
"git.rosy.net.cn/baseapi"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
//import (
|
//import (
|
||||||
@@ -24,32 +27,33 @@ var (
|
|||||||
// testShopNo = "11047059"
|
// testShopNo = "11047059"
|
||||||
//)
|
//)
|
||||||
//
|
//
|
||||||
//func init() {
|
func init() {
|
||||||
// logger, _ := zap.NewDevelopment()
|
logger, _ := zap.NewDevelopment()
|
||||||
// sugarLogger = logger.Sugar()
|
sugarLogger = logger.Sugar()
|
||||||
// baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
//
|
|
||||||
// // sandbox
|
// sandbox
|
||||||
// // dadaapi = New("dada9623324449cd250", "30c2abbfe8a8780ad5aace46300c64b9", "73753", "http://callback.jxc4.com/dada/order", false)
|
// dadaapi = New("dada9623324449cd250", "30c2abbfe8a8780ad5aace46300c64b9", "73753", "http://callback.jxc4.com/dada/order", false)
|
||||||
//
|
|
||||||
// // prod
|
// prod
|
||||||
// dadaapi = New("dada154e2a41fd6cef3", "7f97d8f258b70b450f04e7ab274ed8f8", "6660", "http://callback.jxc4.com/dadadelivery/msg", true)
|
dadaapi = New("dada154e2a41fd6cef3", "7f97d8f258b70b450f04e7ab274ed8f8", "6660", "http://callback.jxc4.com/dadadelivery/msg", true)
|
||||||
//
|
|
||||||
// // prod
|
// prod
|
||||||
// testOrder = &OperateOrderParams{
|
//testOrder = &OperateOrderParams{
|
||||||
// ShopNo: testShopNo,
|
// ShopNo: testShopNo,
|
||||||
// OriginID: "234242342",
|
// OriginID: "234242342",
|
||||||
// CityCode: "028",
|
// CityCode: "028",
|
||||||
// CargoPrice: 12.34,
|
// CargoPrice: 12.34,
|
||||||
// IsPrepay: 1,
|
// IsPrepay: 1,
|
||||||
// ReceiverName: "我是谁",
|
// ReceiverName: "我是谁",
|
||||||
// ReceiverAddress: "九里堤",
|
// ReceiverAddress: "九里堤",
|
||||||
// ReceiverLat: 30.74631,
|
// ReceiverLat: 30.74631,
|
||||||
// ReceiverLng: 103.99112,
|
// ReceiverLng: 103.99112,
|
||||||
// ReceiverPhone: "12812345678",
|
// ReceiverPhone: "12812345678",
|
||||||
// }
|
//}
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//func TestTest(t *testing.T) {
|
//func TestTest(t *testing.T) {
|
||||||
// sugarLogger.Debug(utils.GetCurTimeStr())
|
// sugarLogger.Debug(utils.GetCurTimeStr())
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dadaapi
|
|||||||
|
|
||||||
//
|
//
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"git.rosy.net.cn/baseapi"
|
||||||
//"fmt"
|
//"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
//"git.rosy.net.cn/baseapi"
|
//"git.rosy.net.cn/baseapi"
|
||||||
@@ -43,13 +43,14 @@ import (
|
|||||||
// // baseapi.SugarLogger.Debug(utils.Format4Output(cancelResponse, false))
|
// // baseapi.SugarLogger.Debug(utils.Format4Output(cancelResponse, false))
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//func TestCancel(t *testing.T) {
|
func TestCancel(t *testing.T) {
|
||||||
// cancelResponse, err := dadaapi.CancelOrder("126099099192000002", ReasonIDOther, "协商一致")
|
cancelResponse, err := dadaapi.CancelOrder("1100551162883899675", ReasonIDOther, "协商一致")
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// t.Fatal(err)
|
t.Fatal(err)
|
||||||
// }
|
}
|
||||||
// baseapi.SugarLogger.Debug(utils.Format4Output(cancelResponse, false))
|
baseapi.SugarLogger.Debug(utils.Format4Output(cancelResponse, false))
|
||||||
//}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//func TestGetComplaintReasons(t *testing.T) {
|
//func TestGetComplaintReasons(t *testing.T) {
|
||||||
// complaintReason, err := dadaapi.GetComplaintReasons()
|
// complaintReason, err := dadaapi.GetComplaintReasons()
|
||||||
@@ -76,7 +77,4 @@ func TestQueryOrderInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAddTip(t *testing.T) {
|
func TestAddTip(t *testing.T) {
|
||||||
payload := map[string]interface{}{"categoryID": 3095}
|
|
||||||
fmt.Println(payload["img"] != nil)
|
|
||||||
fmt.Println(payload["img"] != "")
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,20 +26,20 @@ type GetAutoTokenRes struct {
|
|||||||
|
|
||||||
// PreCreateOrderReq 快手预发单
|
// PreCreateOrderReq 快手预发单
|
||||||
type PreCreateOrderReq struct {
|
type PreCreateOrderReq struct {
|
||||||
OutOrderNo string `json:"out_order_no"` // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
|
OutOrderNo string `json:"out_order_no"` // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
|
||||||
OpenId string `json:"open_id"` // 快手用户在当前小程序的open_id
|
OpenId string `json:"open_id"` // 快手用户在当前小程序的open_id
|
||||||
TotalAmount int64 `json:"total_amount"` // 用户支付金额,单位为[分]。
|
TotalAmount int64 `json:"total_amount"` // 用户支付金额,单位为[分]。
|
||||||
Subject string `json:"subject"` // 商品描述。注:1汉字=2字符。
|
Subject string `json:"subject"` // 商品描述。注:1汉字=2字符。
|
||||||
Detail string `json:"detail"` // 商品详情。注:1汉字=2字符。
|
Detail string `json:"detail"` // 商品详情。注:1汉字=2字符。
|
||||||
TypeDetail int `json:"type"` // 商品类型,不同商品类目的编号见
|
TypeDetail int `json:"type"` // 商品类型,不同商品类目的编号见
|
||||||
ExpireTime int `json:"expire_time"` // 订单过期时间,单位秒
|
ExpireTime int `json:"expire_time"` // 订单过期时间,单位秒
|
||||||
Sign string `json:"sign"` // 签名
|
Sign string `json:"sign"` // 签名
|
||||||
Attach string `json:"attach"` // 开发者自定义字段,回调原样回传.
|
//Attach string `json:"attach"` // 开发者自定义字段,回调原样回传.
|
||||||
NotifyUrl string `json:"notify_url"` // 回调地址
|
NotifyUrl string `json:"notify_url"` // 回调地址
|
||||||
GoodsId string `json:"goods_id"` // 下单商品id,需与商品对接 (opens new window)时的product_id一致,长度限制256个英文字符,1个汉字=2个英文字符;
|
//GoodsId string `json:"goods_id"` // 下单商品id,需与商品对接 (opens new window)时的product_id一致,长度限制256个英文字符,1个汉字=2个英文字符;
|
||||||
GoodsDetailUrl string `json:"goods_detail_url"` // 订单详情页跳转path。
|
//GoodsDetailUrl string `json:"goods_detail_url"` // 订单详情页跳转path。
|
||||||
MultiCopiesGoodsInfo string `json:"multi_copies_goods_info"` // 单商品购买多份场景 "[{"copies":2}]"
|
//MultiCopiesGoodsInfo string `json:"multi_copies_goods_info"` // 单商品购买多份场景 "[{"copies":2}]"
|
||||||
CancelOrder int64 `json:"cancel_order"` // 该字段表示创建订单的同时是否覆盖之前已存在的订单。
|
CancelOrder int64 `json:"cancel_order"` // 该字段表示创建订单的同时是否覆盖之前已存在的订单。
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreCreateOrderResponse 预下单返回参数
|
// PreCreateOrderResponse 预下单返回参数
|
||||||
|
|||||||
@@ -72,20 +72,20 @@ func TestCreateToken(t *testing.T) {
|
|||||||
// 快手预下单获取支付参数
|
// 快手预下单获取支付参数
|
||||||
func TestPreCreateOrder(t *testing.T) {
|
func TestPreCreateOrder(t *testing.T) {
|
||||||
param := &PreCreateOrderReq{
|
param := &PreCreateOrderReq{
|
||||||
OutOrderNo: "1024028220",
|
OutOrderNo: "88422209072664",
|
||||||
OpenId: "f198f59711c9785314bf5724f7ab9f47",
|
OpenId: "f198f59711c9785314bf5724f7ab9f47",
|
||||||
TotalAmount: 1,
|
TotalAmount: 501,
|
||||||
Subject: "这是一个测试商品",
|
Subject: "蔬菜水果日用品",
|
||||||
Detail: "大白菜,小白菜,中白菜",
|
Detail: "收藏门店 赠送随机小惊喜一份!1g/个 x 1件商品",
|
||||||
TypeDetail: 1832, // 素菜
|
TypeDetail: 1832, // 素菜
|
||||||
ExpireTime: 10 * 60,
|
ExpireTime: 10 * 60,
|
||||||
Sign: "",
|
Sign: "",
|
||||||
Attach: "1111",
|
//Attach: "22",
|
||||||
NotifyUrl: "https://callback.jxc4.com/tictoc/tiktokMsg",
|
NotifyUrl: "https://callback-jxgy.jxc4.com/kuaishou/kuaiShouCallback",
|
||||||
GoodsId: "1122",
|
//GoodsId: "1122",
|
||||||
GoodsDetailUrl: "/page/index/anima",
|
//GoodsDetailUrl: "/page/index/anima",
|
||||||
MultiCopiesGoodsInfo: "[{\"copies\":2}]",
|
//MultiCopiesGoodsInfo: `[{"copies":2}]`,
|
||||||
CancelOrder: 0,
|
CancelOrder: 1,
|
||||||
}
|
}
|
||||||
data, err := api.PreCreateOrder(param)
|
data, err := api.PreCreateOrder(param)
|
||||||
globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false))
|
globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false))
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package tonglianpayapi
|
|||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -192,6 +193,8 @@ func (a *API) CreateUnitorderOrder(param *CreateUnitorderOrderParam) (result *Cr
|
|||||||
params["paytype"] = param.PayType
|
params["paytype"] = param.PayType
|
||||||
params["sub_appid"] = param.SubAppID
|
params["sub_appid"] = param.SubAppID
|
||||||
retVal, err := a.AccessAPI(sepcAction, params)
|
retVal, err := a.AccessAPI(sepcAction, params)
|
||||||
|
globals.SugarLogger.Debugf("===========err := %s", utils.Format4Output(retVal, false))
|
||||||
|
globals.SugarLogger.Debugf("===========err := %s", utils.Format4Output(err, false))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
utils.Map2StructByJson(retVal, &result, false)
|
utils.Map2StructByJson(retVal, &result, false)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user