物料下单终极测试
This commit is contained in:
@@ -23,7 +23,7 @@ const (
|
||||
ShopNo = "ESP0020000066348"
|
||||
WarehouseNo = "110014006"
|
||||
CustomerCode = "028K595510"
|
||||
OrderMark = "00000"
|
||||
OrderMark = "00000000000000000000000000000000000000000000000000"
|
||||
|
||||
// CustomerCode2 = "028K588716"
|
||||
|
||||
@@ -53,20 +53,21 @@ type QuerySpSourceResult struct {
|
||||
}
|
||||
|
||||
type AddOrderParam struct {
|
||||
IsvUUID string `json:"isvUUID"` //isv出库单号(商家出库单号),作为isv出库的唯一性校验码:长度不能超125
|
||||
IsvSource string `json:"isvSource"` //ISV来源编号
|
||||
ShopNo string `json:"shopNo"` //店铺编号(B2C订单必填,B2B(soType=2)订单非必填)
|
||||
DepartmentNo string `json:"departmentNo"` //事业部编号,且与pin匹配
|
||||
WarehouseNo string `json:"warehouseNo"` //库房编号,事业部开启寻源拆分服务可不填;否则必填;
|
||||
SalesPlatformOrderNo string `json:"salesPlatformOrderNo"` //销售平台订单号,如果销售平台来源为京东平台,则该字段不能为空,长度不超过200
|
||||
SalePlatformSource string `json:"salePlatformSource"` //销售平台来源
|
||||
ConsigneeName string `json:"consigneeName"` //收货人姓名,长度不能超20
|
||||
ConsigneeMobile string `json:"consigneeMobile"` //收货人手机(收货人电话、手机至少有一个不为空),长度不能超30
|
||||
ConsigneeAddress string `json:"consigneeAddress"` //收货人地址 ,长度不能超100
|
||||
OrderMark string `json:"orderMark"` //订单标记位,首位为1代表货到付款
|
||||
GoodsNo []string `json:"goodsNo"` //ECLP商品编号,与商家商品编号二选一必填(两者都指定,以goodsNo为准)
|
||||
Price []float64 `json:"price"` //商品金额,会在订单面单上线上商品单价
|
||||
Quantity []int `json:"quantity"` //商品的出库数量,必须>0
|
||||
IsvUUID string `json:"isvUUID"` //isv出库单号(商家出库单号),作为isv出库的唯一性校验码:长度不能超125
|
||||
IsvSource string `json:"isvSource"` //ISV来源编号
|
||||
ShopNo string `json:"shopNo"` //店铺编号(B2C订单必填,B2B(soType=2)订单非必填)
|
||||
DepartmentNo string `json:"departmentNo"` //事业部编号,且与pin匹配
|
||||
WarehouseNo string `json:"warehouseNo"` //库房编号,事业部开启寻源拆分服务可不填;否则必填;
|
||||
SalesPlatformOrderNo string `json:"salesPlatformOrderNo"` //销售平台订单号,如果销售平台来源为京东平台,则该字段不能为空,长度不超过200
|
||||
SalePlatformSource string `json:"salePlatformSource"` //销售平台来源
|
||||
ConsigneeName string `json:"consigneeName"` //收货人姓名,长度不能超20
|
||||
ConsigneeMobile string `json:"consigneeMobile"` //收货人手机(收货人电话、手机至少有一个不为空),长度不能超30
|
||||
ConsigneeAddress string `json:"consigneeAddress"` //收货人地址 ,长度不能超100
|
||||
OrderMark string `json:"orderMark"` //订单标记位,首位为1代表货到付款
|
||||
// GoodsNo string `json:"goodsNo"` //ECLP商品编号,与商家商品编号二选一必填(两者都指定,以goodsNo为准)
|
||||
Price string `json:"price"` //商品金额,会在订单面单上线上商品单价
|
||||
Quantity string `json:"quantity"` //商品的出库数量,必须>0
|
||||
IsvGoodsNo string `json:"isvGoodsNo"` //商家商品编码
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
if err == nil {
|
||||
if utils.Interface2String(jsonResult1["error_response"]) != "" {
|
||||
if jsonResult1["error_response"] != nil {
|
||||
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))
|
||||
}
|
||||
retVal = jsonResult1
|
||||
@@ -224,7 +225,7 @@ func (a *API) QuerySpSource() (querySpSourceResult []*QuerySpSourceResult, err e
|
||||
func (a *API) AddOrder(addOrderParam *AddOrderParam) (eclpSoNo string, err error) {
|
||||
result, err := a.AccessAPI("jingdong.eclp.order.addOrder", prodURL, utils.Struct2FlatMap(addOrderParam))
|
||||
if err == nil {
|
||||
return result["eclpSoNo"].(string), err
|
||||
return result["jingdong_eclp_order_addOrder_responce"].(map[string]interface{})["eclpSoNo"].(string), err
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
@@ -236,7 +237,7 @@ func (a *API) CancelOrder(eclpSoNo string) (cancelOrderResult *CancelOrderResult
|
||||
"eclpSoNo": eclpSoNo,
|
||||
})
|
||||
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
|
||||
}
|
||||
|
||||
@@ -31,7 +31,20 @@ func TestQuerySpSource(t *testing.T) {
|
||||
|
||||
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",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -39,7 +52,11 @@ func TestAddOrder(t *testing.T) {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
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) {
|
||||
api.QueryOrderStatus("")
|
||||
|
||||
Reference in New Issue
Block a user