对接新供应链-唯品尚
This commit is contained in:
parent
96c87f015d
commit
be569bda75
@ -13,3 +13,35 @@ type CreateAfsApplyReq struct {
|
||||
PickwareCounty string `json:"pickwareCounty"` // 县区 是 String [县区] 芙蓉区
|
||||
PickwareAddress string `json:"pickwareAddress"` //详细地址 是 String [县区] 塔南路59号2号楼2单元1301室
|
||||
}
|
||||
|
||||
type GetManyPostageReq struct {
|
||||
GoodsInfo string `json:"goodsInfo"` //商品数组 goodsInfo 是 json 需要转成json形式的字符串
|
||||
Address string `json:"address"` // 详细地址 address 是 String
|
||||
County string `json:"county"` // 区 county 是 String
|
||||
Province string `json:"province"` //省份 province 是 String
|
||||
City string `json:"city"` //城市 city 是 String
|
||||
}
|
||||
|
||||
type PreOrderReq struct {
|
||||
LockCode string `json:"lockCode"` //预下单编码 lockCode 是 String
|
||||
ConsigneeContacts string `json:"consigneeContacts"` //收货人姓名 consigneeContacts 是 String
|
||||
ConsigneePhone string `json:"consigneePhone"` //收货人手机号 consigneePhone 是 String
|
||||
Province string `json:"province"` //省份 province 是 String
|
||||
City string `json:"city"` //城市 city 是 String
|
||||
Address string `json:"address"` // 详细地址 address 是 String
|
||||
Area string `json:"area"` //区 area 是 String 区
|
||||
GoodsInfo string `json:"goodsInfo"` //商品数组 goodsInfo 是 json 需要转成json形式的字符串
|
||||
Source string `json:"source"` //订单来源 请求渠道号
|
||||
}
|
||||
|
||||
type GoodsInfo struct {
|
||||
GoodSpecId string `json:"goodSpecId"` //商品ID goodSpecId 是 String 商品ID(c_goods_id)
|
||||
GoodsId string `json:"goodsId"` //商品父 goodsId 是 String 商品父ID(c_father_goods_id)
|
||||
Num string `json:"num"` // 数量
|
||||
}
|
||||
|
||||
type CreateOrderReq struct {
|
||||
LockCode string `json:"lockCode"` //预下单编码 lockCode 是 String
|
||||
OrderNo string `json:"orderNo"` //对接方业务单号 orderNo 是 String
|
||||
NoticeUrl string `json:"noticeUrl"` //合作方通知地址 noticeUrl 否 String 规定值 如支持,订单更新实时通知。此参数可不用传,统一走异步回调
|
||||
}
|
||||
|
@ -1,5 +1,38 @@
|
||||
package weipinshang_api
|
||||
|
||||
type GetManyPostageRes struct {
|
||||
Code int `json:"code"` // 0为成功,其它为失败
|
||||
Msg string `json:"msg"` // 请求接口消息
|
||||
Data []FreightData `json:"data"` // 返回数据 data array
|
||||
}
|
||||
type FreightData struct {
|
||||
Freight string `json:"freight"` // 邮费 freight 是 string 邮费
|
||||
}
|
||||
|
||||
type PreOrderRes struct {
|
||||
Code int `json:"code"` // 0为成功,其它为失败
|
||||
Msg string `json:"msg"` // 请求接口消息
|
||||
Data []PreOrderFreightData `json:"data"` // 返回数据 data array
|
||||
}
|
||||
type PreOrderFreightData struct {
|
||||
Freight string `json:"freight"` // 邮费 freight 是 string 邮费
|
||||
FreightDesc string `json:"freight_desc"` // 邮费说明 freight_desc 是 string 邮费说明
|
||||
}
|
||||
|
||||
type CreateOrderRes struct {
|
||||
McOrderNo string `json:"mc_order_no"` //蜜仓子订单号
|
||||
OrderAmount float64 `json:"order_amount"` // 子订单总金额
|
||||
Sku []SkuData `json:"sku"` // 订单商品信息
|
||||
}
|
||||
|
||||
type SkuData struct {
|
||||
GoodSpecId string `json:"good_spec_id"` //商品ID(c_goods_id)
|
||||
GoodsId string `json:"goods_id"` //商品ID(c_father_goods_id)
|
||||
GoodName string `json:"good_name"` //商品名称
|
||||
Num string `json:"num"` //数量
|
||||
Price string `json:"price"` //单价
|
||||
}
|
||||
|
||||
type GetOrderInfoRes struct {
|
||||
Code int `json:"code"` // 0为成功,其它为失败
|
||||
Msg string `json:"msg"` // 请求接口消息
|
||||
@ -26,6 +59,15 @@ type Data struct {
|
||||
CReceiverMobile string `json:"c_receiver_mobile"` // 收货人联系方式
|
||||
}
|
||||
|
||||
type GetOrderInfoByItemNORes struct {
|
||||
OrderItemNo string `json:"order_item_no"` // 子订单号
|
||||
SendStatus string `json:"send_status"` //发货状态【’CHECKED订单被创建’,’INSTOCK已备货’,’SENDED已发货’,’RECEIVED已收货’】
|
||||
DeliveryName string `json:"delivery_name"` // 快递公司
|
||||
DeliveryNo string `json:"delivery_no"` // 快递单号
|
||||
RefuseStatus string `json:"refuse_status"` //售后状态【CREATED 创建售后单’,’ALLOW同意’,’SUCCESS成功’,’NOTALLOW拒绝’,’MONEY_RETURNED已操作退款’,’FAIL_RETURNED退款失败,线下退款’】
|
||||
RefuseType string `json:"refuse_type"` // 售后类型【’RETURN_MONEY 退款’,’RETURN_GOODS 退货’】
|
||||
}
|
||||
|
||||
type IsRefundRes struct {
|
||||
Code int `json:"code"` // 0为成功,其它为失败
|
||||
Msg string `json:"msg"` // 请求接口消息
|
||||
|
@ -25,6 +25,78 @@ func NewWeiPinShangClient(host, channelType, key string) *WeiPinShangClient {
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) GetManyPostage(getManyPostageReq GetManyPostageReq) (res *GetManyPostageRes, err error) {
|
||||
fmt.Println("getManyPostageReq", getManyPostageReq)
|
||||
paramMap := make(map[string]any)
|
||||
|
||||
paramMap["goodsInfo"] = getManyPostageReq.GoodsInfo
|
||||
paramMap["address"] = getManyPostageReq.Address
|
||||
paramMap["province"] = getManyPostageReq.Province
|
||||
paramMap["county"] = getManyPostageReq.County
|
||||
paramMap["city"] = getManyPostageReq.City
|
||||
|
||||
postRes, err := w.WPSPost("/mcang/Mcang/getManyPostage", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换GetManyPostageRes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) PreOrder(preOrderReq PreOrderReq) (res *PreOrderRes, err error) {
|
||||
fmt.Println("preOrderReq", preOrderReq)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["lockCode"] = preOrderReq.LockCode
|
||||
paramMap["consigneeContacts"] = preOrderReq.ConsigneeContacts
|
||||
paramMap["consigneePhone"] = preOrderReq.ConsigneePhone
|
||||
|
||||
paramMap["address"] = preOrderReq.Address
|
||||
paramMap["province"] = preOrderReq.Province
|
||||
paramMap["area"] = preOrderReq.Area
|
||||
paramMap["city"] = preOrderReq.City
|
||||
|
||||
paramMap["goodsInfo"] = preOrderReq.GoodsInfo
|
||||
paramMap["source"] = preOrderReq.Source
|
||||
postRes, err := w.WPSPost("/mcang/Order/preOrder", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换PreOrderRes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) CreateOrder(createOrderReq CreateOrderReq) (res *CreateOrderRes, err error) {
|
||||
fmt.Println("createOrderReq", createOrderReq)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["lockCode"] = createOrderReq.LockCode
|
||||
paramMap["orderNo"] = createOrderReq.OrderNo
|
||||
paramMap["noticeUrl"] = createOrderReq.NoticeUrl
|
||||
postRes, err := w.WPSPost("/mcang/Order/createOrder", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换CreateOrderRes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res *GetOrderInfoRes, err error) {
|
||||
fmt.Println("orderNo", orderNo)
|
||||
paramMap := make(map[string]any)
|
||||
@ -43,6 +115,24 @@ func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res *GetOrderInfoRes,
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfoByItemNO(mcOrderNo string) (res *GetOrderInfoByItemNORes, err error) {
|
||||
fmt.Println("mcOrderNo", mcOrderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["mcOrderNo"] = mcOrderNo
|
||||
postRes, err := w.WPSPost("/mcang/Mcang/getOrderInfoByItemNO", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换GetOrderInfoByItemNORes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res *IsRefundRes, err error) {
|
||||
fmt.Println("mcOrderNo", mcOrderNo)
|
||||
paramMap := make(map[string]any)
|
||||
@ -54,7 +144,7 @@ func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res *IsRefundRes, err er
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换结构体失败: %s", string(postRes))
|
||||
err = fmt.Errorf("转换IsRefundRes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
return
|
||||
@ -85,7 +175,7 @@ func (w *WeiPinShangClient) CreateAfsApply(createAfsApplyReq CreateAfsApplyReq)
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换结构体失败: %s", string(postRes))
|
||||
err = fmt.Errorf("转换CreateAfsApplyRes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
return
|
||||
@ -102,7 +192,7 @@ func (w *WeiPinShangClient) OrderCancel(mcOrderNo string) (res *OrderCancelRes,
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换结构体失败: %s", string(postRes))
|
||||
err = fmt.Errorf("转换OrderCancelRes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user