Merge branch 'refs/heads/feature/对接新供应链-唯品尚'
This commit is contained in:
commit
3957f3b5b9
@ -35,8 +35,8 @@ type PreOrderReq struct {
|
||||
}
|
||||
|
||||
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)
|
||||
GoodSpecId string `json:"goodSpecId"` //SKU ID goodSpecId 是 String 商品ID(c_goods_id)
|
||||
GoodsId string `json:"goodsId"` //商品ID goodsId 是 String 商品父ID(c_father_goods_id)
|
||||
Num string `json:"num"` // 数量
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,9 @@ type GetOrderInfoRes struct {
|
||||
Data []Data `json:"data"` // 返回数据 data array
|
||||
}
|
||||
type Data struct {
|
||||
CThirdUserCode string `json:"c_third_user_code"` // 用户编码
|
||||
COrderNoThird string `json:"c_order_no_third"` // 渠道订单号
|
||||
CThirdUserCode string `json:"c_third_user_code"` // 用户编码
|
||||
//COrderNoThird string `json:"c_order_no_third"` // 渠道订单号
|
||||
COrderNo string `json:"c_order_no"` // 渠道订单号
|
||||
COrderNoPayservice string `json:"c_order_no_payservice"` //支付订单号
|
||||
CSendStatus string `json:"c_send_status"` // 订单状态 订单所处阶段【’’CHECKED订单被创建’’,’INSTOCK已备货’,’’SENDED已发货’’,’’RECEIVED已收货’’】
|
||||
CIsPay int `json:"c_is_pay"` // 支付状态(0-未支付,1-已支付)
|
||||
@ -81,6 +82,8 @@ type GetOrderInfoByThirdNORes struct {
|
||||
Data []OrderInfoData `json:"data"` // 返回数据 data array
|
||||
}
|
||||
type OrderInfoData struct {
|
||||
GoodsId string `json:"goodsId"` //商品ID goodsId 是 String 商品父ID(c_father_goods_id)
|
||||
GoodSpecId string `json:"goodSpecId"` //SKU ID goodSpecId 是 String 商品ID(c_goods_id)
|
||||
OrderItemNo string `json:"order_item_no"` // 子订单号
|
||||
SendStatus string `json:"send_status"` //发货状态【’CHECKED订单被创建’,’INSTOCK已备货’,’SENDED已发货’,’RECEIVED已收货’】
|
||||
DeliveryName string `json:"delivery_name"` // 快递公司
|
||||
|
@ -25,6 +25,8 @@ func NewWeiPinShangClient(host, channelType, key string) *WeiPinShangClient {
|
||||
}
|
||||
}
|
||||
|
||||
// pay
|
||||
|
||||
func (w *WeiPinShangClient) GetManyPostage(getManyPostageReq *GetManyPostageReq) (res *GetManyPostageRes, err error) {
|
||||
fmt.Println("getManyPostageReq", getManyPostageReq)
|
||||
paramMap := make(map[string]any)
|
||||
@ -97,6 +99,8 @@ func (w *WeiPinShangClient) CreateOrder(createOrderReq *CreateOrderReq) (res *Cr
|
||||
return
|
||||
}
|
||||
|
||||
// GetOrderInfo 1
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res *GetOrderInfoRes, err error) {
|
||||
fmt.Println("orderNo", orderNo)
|
||||
paramMap := make(map[string]any)
|
||||
@ -115,6 +119,28 @@ func (w *WeiPinShangClient) GetOrderInfo(orderNo string) (res *GetOrderInfoRes,
|
||||
return
|
||||
}
|
||||
|
||||
// GetOrderInfo n
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfoByThirdNO(orderNo string) (res *GetOrderInfoByThirdNORes, err error) {
|
||||
fmt.Println("orderNo", orderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["orderNo"] = orderNo
|
||||
postRes, err := w.WPSPost("mcang/Order/getOrderInfoByThirdNO", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换GetOrderInfoByThirdNORes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// refund
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfoByItemNO(mcOrderNo string) (res *GetOrderInfoByItemNORes, err error) {
|
||||
fmt.Println("mcOrderNo", mcOrderNo)
|
||||
//paramMap := make(map[string]any)
|
||||
@ -136,24 +162,6 @@ func (w *WeiPinShangClient) GetOrderInfoByItemNO(mcOrderNo string) (res *GetOrde
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) GetOrderInfoByThirdNO(orderNo string) (res *GetOrderInfoByThirdNORes, err error) {
|
||||
fmt.Println("orderNo", orderNo)
|
||||
paramMap := make(map[string]any)
|
||||
paramMap["orderNo"] = orderNo
|
||||
postRes, err := w.WPSPost("mcang/Order/getOrderInfoByThirdNO", paramMap)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(postRes, &res)
|
||||
if err != nil || res == nil {
|
||||
err = fmt.Errorf("转换GetOrderInfoByThirdNORes结构体失败: %s", string(postRes))
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (w *WeiPinShangClient) IsRefund(mcOrderNo string) (res *IsRefundRes, err error) {
|
||||
fmt.Println("mcOrderNo", mcOrderNo)
|
||||
paramMap := make(map[string]any)
|
||||
|
@ -159,6 +159,53 @@ func TestWeiPinShangClient_CreateOrder(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWeiPinShangClient_GetOrderInfo(t *testing.T) {
|
||||
type fields struct {
|
||||
Host string
|
||||
ChannelType string
|
||||
Key string
|
||||
}
|
||||
type args struct {
|
||||
orderNo string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
fields fields
|
||||
args args
|
||||
wantRes *GetOrderInfoRes
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "test1",
|
||||
fields: fields{
|
||||
Host: "https://uat.api.weipinshang.net/",
|
||||
ChannelType: "AILEHUI",
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: args{
|
||||
orderNo: "20250527172503439229",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
h := &WeiPinShangClient{
|
||||
Host: test.fields.Host,
|
||||
ChannelType: test.fields.ChannelType,
|
||||
Key: test.fields.Key,
|
||||
}
|
||||
|
||||
gotRes, err := h.GetOrderInfo(test.args.orderNo)
|
||||
|
||||
log.Println(gotRes, err)
|
||||
|
||||
if (err != nil) != test.wantErr {
|
||||
t.Errorf("GetManyPostage() error = %v, wantErr %v", err, test.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWeiPinShangClient_GetOrderInfoByItemNO(t *testing.T) {
|
||||
type fields struct {
|
||||
Host string
|
||||
@ -233,6 +280,17 @@ func TestWeiPinShangClient_GetOrderInfoByThirdNO(t *testing.T) {
|
||||
orderNo: "10000000000",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "test1",
|
||||
fields: fields{
|
||||
Host: "https://uat.api.weipinshang.net/",
|
||||
ChannelType: "AILEHUI",
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: args{
|
||||
orderNo: "20250527172503439229",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user