对接新供应链-唯品尚
This commit is contained in:
parent
1b97811c6a
commit
0b6b76c708
@ -5,6 +5,7 @@ import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@ -297,7 +298,7 @@ func (w *WeiPinShangClient) WPSPost(url string, paramMap map[string]any) (res []
|
||||
fmt.Printf("res: %s\n", string(res))
|
||||
|
||||
if !json.Valid(res) {
|
||||
return nil, fmt.Errorf("响应不是有效的JSON格式: %s", string(res))
|
||||
return nil, errors.New("响应体不是有效的JSON格式")
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -233,7 +233,7 @@ func TestWeiPinShangClient_GetOrderInfoByItemNO(t *testing.T) {
|
||||
},
|
||||
args: args{
|
||||
//mcOrderNo: "mc20250527174640537475",
|
||||
mcOrderNo: "mc20250529102347485667",
|
||||
mcOrderNo: "mc20250616115732440085",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -292,7 +292,7 @@ func TestWeiPinShangClient_GetOrderInfoByThirdNO(t *testing.T) {
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: args{
|
||||
orderNo: "20250527172503439229",
|
||||
orderNo: "570872619444771455",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -339,7 +339,7 @@ func TestWeiPinShangClient_IsRefund(t *testing.T) {
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: args{
|
||||
mcOrderNo: "mc20250529102347907570",
|
||||
mcOrderNo: "mc20250613182629112823",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -409,6 +409,61 @@ func TestWeiPinShangClient_OrderCancel(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWeiPinShangClient_CreateAfsApply(t *testing.T) {
|
||||
type fields struct {
|
||||
Host string
|
||||
ChannelType string
|
||||
Key string
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
fields fields
|
||||
args CreateAfsApplyReq
|
||||
wantRes *IsRefundRes
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "test1",
|
||||
fields: fields{
|
||||
Host: "https://uat.api.weipinshang.net/",
|
||||
ChannelType: "AILEHUI",
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: CreateAfsApplyReq{
|
||||
CustomerContactName: "钟",
|
||||
CustomerExpect: 10,
|
||||
CustomerMobilePhone: "15375399426",
|
||||
CustomerTel: "15375399426",
|
||||
McOrderNo: "mc20250613182629112823",
|
||||
PickwareAddress: "奥园",
|
||||
PickwareCity: "广州",
|
||||
PickwareCounty: "番禺",
|
||||
PickwareProvince: "广东",
|
||||
QuestionDesc: "商品问题",
|
||||
QuestionPic: "11",
|
||||
},
|
||||
},
|
||||
}
|
||||
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.CreateAfsApply(&test.args)
|
||||
|
||||
log.Println(gotRes, err)
|
||||
|
||||
if (err != nil) != test.wantErr {
|
||||
t.Errorf("GetManyPostage() error = %v, wantErr %v", err, test.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// test ---------------------------------------------------
|
||||
|
||||
func TestWeiPinShangClient_DeliverGoods(t *testing.T) {
|
||||
@ -433,7 +488,7 @@ func TestWeiPinShangClient_DeliverGoods(t *testing.T) {
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: DeliverGoodsReq{
|
||||
COrderItemNo: "mc20250527172503957733",
|
||||
COrderItemNo: "mc20250613182629112823",
|
||||
CDeliveryName: "顺丰",
|
||||
CDeliveryNo: "1234567890",
|
||||
},
|
||||
@ -447,9 +502,9 @@ func TestWeiPinShangClient_DeliverGoods(t *testing.T) {
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: DeliverGoodsReq{
|
||||
COrderItemNo: "mc20250530115549372224",
|
||||
CDeliveryName: "京东",
|
||||
CDeliveryNo: "1234567890",
|
||||
COrderItemNo: "mc20250616113428587322",
|
||||
CDeliveryName: "顺丰0",
|
||||
CDeliveryNo: "SF9900000099",
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -493,7 +548,7 @@ func TestWeiPinShangClient_UpdateService(t *testing.T) {
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: UpdateServiceReq{
|
||||
COrderItemNo: "20250527172503439229",
|
||||
COrderItemNo: "mc20250612153935670660",
|
||||
CType: "1",
|
||||
},
|
||||
},
|
||||
@ -506,7 +561,7 @@ func TestWeiPinShangClient_UpdateService(t *testing.T) {
|
||||
Key: "f654ea5bde7635c3f46191191e5c4c8e",
|
||||
},
|
||||
args: UpdateServiceReq{
|
||||
COrderItemNo: "mc20250530172009173148",
|
||||
COrderItemNo: "mc20250609180246814560",
|
||||
CType: "3",
|
||||
},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user