144 lines
3.4 KiB
Go
144 lines
3.4 KiB
Go
package jdeclpapi
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
|
|
"git.rosy.net.cn/baseapi"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
var (
|
|
api *API
|
|
sugarLogger *zap.SugaredLogger
|
|
)
|
|
|
|
func init() {
|
|
logger, _ := zap.NewDevelopment()
|
|
sugarLogger = logger.Sugar()
|
|
baseapi.Init(sugarLogger)
|
|
api = New("161eff890f2f4fbda942447f85843377wzmo", "0D397F05CF11C51BCDCC81744680EBC3", "f16a5e57ff4f4f428b702c40d2d4b933")
|
|
}
|
|
|
|
func TestQuerySpSource(t *testing.T) {
|
|
result, err := api.QuerySpSource()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestAddOrder(t *testing.T) {
|
|
result, err := api.AddOrder(&AddOrderParam{
|
|
IsvUUID: "88321464273509",
|
|
IsvSource: IsvSource,
|
|
ShopNo: ShopNo,
|
|
DepartmentNo: DepartmentNo,
|
|
WarehouseNo: WarehouseNo,
|
|
SalePlatformSource: SalePlatformSource,
|
|
SalesPlatformOrderNo: "88321464273509",
|
|
ConsigneeName: "测试用户",
|
|
ConsigneeMobile: "18160030913",
|
|
ConsigneeAddress: "成都市金牛区",
|
|
OrderMark: OrderMark,
|
|
// IsvGoodsNo: "JX10012,JX10011",
|
|
Price: "0,0",
|
|
Quantity: "1,2",
|
|
GoodsNo: "EMG4418111927871,EMG4418111927871",
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
func TestCancelOrder(t *testing.T) {
|
|
result, err := api.CancelOrder("ESL96779108501677")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
func TestQueryOrderStatus(t *testing.T) {
|
|
result, err := api.QueryOrderStatus("ESL96778814627393")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
func TestGetTrackMessagePlusByOrder(t *testing.T) {
|
|
result, err := api.GetTrackMessagePlusByOrder("46304726013148")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
func TestSearchShopStock(t *testing.T) {
|
|
result, err := api.SearchShopStock("EMG4418113943423")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestQueryStock(t *testing.T) {
|
|
result, err := api.QueryStock("")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestWaybillReceive(t *testing.T) {
|
|
_, err := api.WaybillReceive(&WaybillReceiveParam{
|
|
SalePlat: SalePlatSourceDelivery,
|
|
CustomerCode: CustomerCode,
|
|
OrderID: "883289609977992",
|
|
SenderName: "测试别派件",
|
|
SenderAddress: "四川省成都市金牛区加州湾v派",
|
|
SenderTel: "18160030913",
|
|
ReceiveName: "后面会取消",
|
|
ReceiveAddress: "四川省成都市天府大道",
|
|
ReceiveTel: "18160030913",
|
|
PackageCount: 1,
|
|
Weight: 100,
|
|
Vloumn: 10000,
|
|
Description: "测试",
|
|
Aging: 5,
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestCancelWayBill(t *testing.T) {
|
|
err := api.CancelWayBill(&CancelWayBillParam{
|
|
WaybillCode: "JDVD01096487452",
|
|
CustomerCode: CustomerCode,
|
|
Source: "JOS",
|
|
CancelReason: "测试",
|
|
OperatorName: "jxadmin",
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestQueryDynamicTraceInfo(t *testing.T) {
|
|
result, err := api.QueryDynamicTraceInfo("JDVD01376429529")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestWaybillQuery(t *testing.T) {
|
|
result, err := api.WaybillQuery("JDVD01345722555")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|