物料下单终极测试
This commit is contained in:
@@ -23,7 +23,7 @@ const (
|
|||||||
ShopNo = "ESP0020000066348"
|
ShopNo = "ESP0020000066348"
|
||||||
WarehouseNo = "110014006"
|
WarehouseNo = "110014006"
|
||||||
CustomerCode = "028K595510"
|
CustomerCode = "028K595510"
|
||||||
OrderMark = "00000"
|
OrderMark = "00000000000000000000000000000000000000000000000000"
|
||||||
|
|
||||||
// CustomerCode2 = "028K588716"
|
// CustomerCode2 = "028K588716"
|
||||||
|
|
||||||
@@ -64,9 +64,10 @@ type AddOrderParam struct {
|
|||||||
ConsigneeMobile string `json:"consigneeMobile"` //收货人手机(收货人电话、手机至少有一个不为空),长度不能超30
|
ConsigneeMobile string `json:"consigneeMobile"` //收货人手机(收货人电话、手机至少有一个不为空),长度不能超30
|
||||||
ConsigneeAddress string `json:"consigneeAddress"` //收货人地址 ,长度不能超100
|
ConsigneeAddress string `json:"consigneeAddress"` //收货人地址 ,长度不能超100
|
||||||
OrderMark string `json:"orderMark"` //订单标记位,首位为1代表货到付款
|
OrderMark string `json:"orderMark"` //订单标记位,首位为1代表货到付款
|
||||||
GoodsNo []string `json:"goodsNo"` //ECLP商品编号,与商家商品编号二选一必填(两者都指定,以goodsNo为准)
|
// GoodsNo string `json:"goodsNo"` //ECLP商品编号,与商家商品编号二选一必填(两者都指定,以goodsNo为准)
|
||||||
Price []float64 `json:"price"` //商品金额,会在订单面单上线上商品单价
|
Price string `json:"price"` //商品金额,会在订单面单上线上商品单价
|
||||||
Quantity []int `json:"quantity"` //商品的出库数量,必须>0
|
Quantity string `json:"quantity"` //商品的出库数量,必须>0
|
||||||
|
IsvGoodsNo string `json:"isvGoodsNo"` //商家商品编码
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddOrderResult struct {
|
type AddOrderResult struct {
|
||||||
@@ -197,9 +198,9 @@ func (a *API) AccessAPI(action string, url string, bizParams map[string]interfac
|
|||||||
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
return platformapi.ErrLevelRecoverableErr, fmt.Errorf("mapData is nil")
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if utils.Interface2String(jsonResult1["error_response"]) != "" {
|
if jsonResult1["error_response"] != nil {
|
||||||
errLevel = platformapi.ErrLevelGeneralFail
|
errLevel = platformapi.ErrLevelGeneralFail
|
||||||
err = utils.NewErrorCode(utils.Interface2String(jsonResult1["error_response"]), jsonResult1["error_response"].(map[string]interface{})["code"].(string))
|
err = utils.NewErrorCode(jsonResult1["error_response"].(map[string]interface{})["zh_desc"].(string), jsonResult1["error_response"].(map[string]interface{})["code"].(string))
|
||||||
baseapi.SugarLogger.Debugf("jdeclp AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
baseapi.SugarLogger.Debugf("jdeclp AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||||
}
|
}
|
||||||
retVal = jsonResult1
|
retVal = jsonResult1
|
||||||
@@ -224,7 +225,7 @@ func (a *API) QuerySpSource() (querySpSourceResult []*QuerySpSourceResult, err e
|
|||||||
func (a *API) AddOrder(addOrderParam *AddOrderParam) (eclpSoNo string, err error) {
|
func (a *API) AddOrder(addOrderParam *AddOrderParam) (eclpSoNo string, err error) {
|
||||||
result, err := a.AccessAPI("jingdong.eclp.order.addOrder", prodURL, utils.Struct2FlatMap(addOrderParam))
|
result, err := a.AccessAPI("jingdong.eclp.order.addOrder", prodURL, utils.Struct2FlatMap(addOrderParam))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return result["eclpSoNo"].(string), err
|
return result["jingdong_eclp_order_addOrder_responce"].(map[string]interface{})["eclpSoNo"].(string), err
|
||||||
}
|
}
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -236,7 +237,7 @@ func (a *API) CancelOrder(eclpSoNo string) (cancelOrderResult *CancelOrderResult
|
|||||||
"eclpSoNo": eclpSoNo,
|
"eclpSoNo": eclpSoNo,
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
utils.Map2StructByJson(result["jingdong_eclp_order_cancelOrder_response"].(map[string]interface{})["cancelorder_result"], &cancelOrderResult, false)
|
utils.Map2StructByJson(result["jingdong_eclp_order_cancelOrder_responce"].(map[string]interface{})["cancelorder_result"], &cancelOrderResult, false)
|
||||||
}
|
}
|
||||||
return cancelOrderResult, err
|
return cancelOrderResult, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,20 @@ func TestQuerySpSource(t *testing.T) {
|
|||||||
|
|
||||||
func TestAddOrder(t *testing.T) {
|
func TestAddOrder(t *testing.T) {
|
||||||
result, err := api.AddOrder(&AddOrderParam{
|
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",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -39,7 +52,11 @@ func TestAddOrder(t *testing.T) {
|
|||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
func TestCancelOrder(t *testing.T) {
|
func TestCancelOrder(t *testing.T) {
|
||||||
api.CancelOrder("")
|
result, err := api.CancelOrder("ESL96778168766975")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
func TestQueryOrderStatus(t *testing.T) {
|
func TestQueryOrderStatus(t *testing.T) {
|
||||||
api.QueryOrderStatus("")
|
api.QueryOrderStatus("")
|
||||||
|
|||||||
Reference in New Issue
Block a user