回调打桩
This commit is contained in:
@@ -13,6 +13,47 @@ func Init() {
|
|||||||
api.accessToken = token.BusinessDataObj.AccessToken
|
api.accessToken = token.BusinessDataObj.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询单个门店
|
||||||
|
func TestQueryOneStore(t *testing.T) {
|
||||||
|
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
|
||||||
|
token, err := api.GetAccessToken()
|
||||||
|
api.accessToken = token.BusinessDataObj.AccessToken
|
||||||
|
data, err := api.GetStore("209476483")
|
||||||
|
fmt.Println(data)
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正式下单
|
||||||
|
func TestCreateOrder(t *testing.T) {
|
||||||
|
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
|
||||||
|
token, _ := api.GetAccessToken()
|
||||||
|
api.accessToken = token.BusinessDataObj.AccessToken
|
||||||
|
|
||||||
|
aa := []*GoodsItemsList{
|
||||||
|
{"白菜", 1, 100, 100, "30011", 1, "备注:大白菜"},
|
||||||
|
//{"白菜2", 1, 100, 100, "30012", 1, "备注:大白菜2"},
|
||||||
|
// {"白菜3", 1, 100, 100, "1004", 1, "备注:大白菜2"},
|
||||||
|
}
|
||||||
|
err := api.CreateOrder(&CreateOrderReqParam{
|
||||||
|
PartnerOrderCode: "232232999uue21",
|
||||||
|
OrderType: 1,
|
||||||
|
PositionSource: 3,
|
||||||
|
ReceiverAddress: "四川成都",
|
||||||
|
ReceiverLongitude: 116.307892,
|
||||||
|
ReceiverLatitude: 40.039115,
|
||||||
|
GoodsTotalAmountCent: 100,
|
||||||
|
GoodsActualAmountCent: 100,
|
||||||
|
GoodsWeight: 0.25,
|
||||||
|
GoodsCount: 1,
|
||||||
|
GoodsItemList: aa,
|
||||||
|
ReceiverName: "刘磊",
|
||||||
|
ReceiverPrimaryPhone: "18981810340",
|
||||||
|
OutShopCode: "",
|
||||||
|
ChainStoreId: "209476483",
|
||||||
|
})
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
// 创建门店,
|
// 创建门店,
|
||||||
func TestCreateStore(t *testing.T) {
|
func TestCreateStore(t *testing.T) {
|
||||||
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "cabrXQf9eFMVWVYg4hNlwu")
|
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "cabrXQf9eFMVWVYg4hNlwu")
|
||||||
@@ -54,7 +95,7 @@ func TestUpdataStore(t *testing.T) {
|
|||||||
token, _ := api.GetAccessToken()
|
token, _ := api.GetAccessToken()
|
||||||
api.accessToken = token.BusinessDataObj.AccessToken
|
api.accessToken = token.BusinessDataObj.AccessToken
|
||||||
err := api.UpdateStore(&UpdateStoreParam{
|
err := api.UpdateStore(&UpdateStoreParam{
|
||||||
ChainStoreID: "209636747",
|
ChainStoreID: 209636747,
|
||||||
HeadShopName: "刘磊测试门店",
|
HeadShopName: "刘磊测试门店",
|
||||||
ContactPhone: "18981810340",
|
ContactPhone: "18981810340",
|
||||||
Address: "四川成都",
|
Address: "四川成都",
|
||||||
@@ -91,18 +132,6 @@ func TestClient(t *testing.T) {
|
|||||||
fmt.Println("err=====", err)
|
fmt.Println("err=====", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询单个门店
|
|
||||||
func TestQueryOneStore(t *testing.T) {
|
|
||||||
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "51658", "4W4hqacKND6NOct5gCyjbT")
|
|
||||||
token, err := api.GetAccessToken()
|
|
||||||
fmt.Println("err! ========", err)
|
|
||||||
api.accessToken = token.BusinessDataObj.AccessToken
|
|
||||||
fmt.Println("err! ========accessToken", api.accessToken)
|
|
||||||
data, err := api.GetStore("637910")
|
|
||||||
fmt.Println(data)
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 预下单
|
// 预下单
|
||||||
func TestGetOrder(t *testing.T) {
|
func TestGetOrder(t *testing.T) {
|
||||||
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
|
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "")
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TokenURL = "https://open-anubis.ele.me/anubis-webapi/openapi/token" // 正式环境
|
//TokenURL = "https://open-anubis.ele.me/anubis-webapi/openapi/token" // 正式环境
|
||||||
ApiURL = "https://open-anubis.ele.me/anubis-webapi/v3/invoke" // 正式环境
|
//ApiURL = "https://open-anubis.ele.me/anubis-webapi/v3/invoke" // 正式环境
|
||||||
RefreshTokenUrl = "https://open-anubis.ele.me/anubis-webapi/openapi/refreshToken" // 正式环境刷新token
|
RefreshTokenUrl = "https://open-anubis.ele.me/anubis-webapi/openapi/refreshToken" // 正式环境刷新token
|
||||||
//TokenURL = "https://exam-anubis.ele.me/anubis-webapi/openapi/token" // 沙箱环境
|
TokenURL = "https://exam-anubis.ele.me/anubis-webapi/openapi/token" // 沙箱环境
|
||||||
//ApiURL = "https://exam-anubis.ele.me/anubis-webapi/v3/invoke" // 沙箱环境
|
ApiURL = "https://exam-anubis.ele.me/anubis-webapi/v3/invoke" // 沙箱环境
|
||||||
RequestPost = "POST"
|
RequestPost = "POST"
|
||||||
RequestGet = "GET"
|
RequestGet = "GET"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 注册请求api
|
// 注册请求api
|
||||||
@@ -76,8 +76,10 @@ type GetOneStoreParam struct {
|
|||||||
|
|
||||||
// 获取单个门店基础参数(请求)
|
// 获取单个门店基础参数(请求)
|
||||||
type GetOneStore struct {
|
type GetOneStore struct {
|
||||||
MerchantID string `json:"merchant_id"` // 商户id
|
MerchantID string `json:"merchant_id"` // 商户id
|
||||||
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
||||||
|
ChainStoreId string `json:"chain_store_id,omitempty"` // 门店id
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取单个门店(返回)
|
// 获取单个门店(返回)
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ func (a *API) GetStore(storeID string) (getStoreResult *GetOneStoreRespData, err
|
|||||||
BusinessData: "",
|
BusinessData: "",
|
||||||
}
|
}
|
||||||
// 序列化请求参数
|
// 序列化请求参数
|
||||||
data, err := json.Marshal(GetOneStore{MerchantID: a.merchantId, OutShopCode: storeID})
|
//data, err := json.Marshal(GetOneStore{MerchantID: a.merchantId, OutShopCode: storeID}) 正式环境
|
||||||
|
data, err := json.Marshal(GetOneStore{MerchantID: a.merchantId, ChainStoreId: storeID}) // 沙箱
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,37 +37,6 @@ func TestPreOrder(t *testing.T) {
|
|||||||
fmt.Println(baseDeliveryFee)
|
fmt.Println(baseDeliveryFee)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 正式下单
|
|
||||||
func TestCreateOrder(t *testing.T) {
|
|
||||||
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "51658")
|
|
||||||
token, _ := api.GetAccessToken()
|
|
||||||
api.accessToken = token.BusinessDataObj.AccessToken
|
|
||||||
|
|
||||||
aa := []*GoodsItemsList{
|
|
||||||
{"白菜", 1, 100, 100, "30011", 1, "备注:大白菜"},
|
|
||||||
//{"白菜2", 1, 100, 100, "30012", 1, "备注:大白菜2"},
|
|
||||||
// {"白菜3", 1, 100, 100, "1004", 1, "备注:大白菜2"},
|
|
||||||
}
|
|
||||||
err := api.CreateOrder(&CreateOrderReqParam{
|
|
||||||
PartnerOrderCode: "232232999uue21",
|
|
||||||
OrderType: 1,
|
|
||||||
PositionSource: 3,
|
|
||||||
ReceiverAddress: "四川成都",
|
|
||||||
ReceiverLongitude: 113.546508,
|
|
||||||
ReceiverLatitude: 22.188382,
|
|
||||||
GoodsTotalAmountCent: 100,
|
|
||||||
GoodsActualAmountCent: 100,
|
|
||||||
GoodsWeight: 0.25,
|
|
||||||
GoodsCount: 1,
|
|
||||||
GoodsItemList: aa,
|
|
||||||
ReceiverName: "刘磊",
|
|
||||||
ReceiverPrimaryPhone: "18981810340",
|
|
||||||
OutShopCode: "",
|
|
||||||
ChainStoreId: "200008235",
|
|
||||||
})
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 添加小费
|
// 添加小费
|
||||||
func TestAddTip(t *testing.T) {
|
func TestAddTip(t *testing.T) {
|
||||||
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "51658")
|
api = New("6705486294797503379", "c1e6c280-e618-4103-9d0a-673bc54fb22e", "5375691", "51658")
|
||||||
|
|||||||
Reference in New Issue
Block a user