对接新供应链-唯品尚

This commit is contained in:
zhongqiang
2025-05-29 15:12:49 +08:00
parent 79f36b239b
commit c9190ea4d4
4 changed files with 248 additions and 11 deletions

View File

@@ -80,14 +80,14 @@ func TestWeiPinShangClient_PreOrder(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: PreOrderReq{
GoodsInfo: "[{\"goodsId\":\"WPS9_282520\",\"goodSpecId\":\"WPS9_1221183858889276\",\"num\":1}]",
GoodsInfo: "[{\"goodsId\":\"WPS9_282520\",\"goodSpecId\":\"WPS9_1221183858889276\",\"num\":2},{\"goodsId\":\"WPS2_0213160707208717\",\"goodSpecId\":\"WPS2_0213160707965791\",\"num\":2}]",
Province: "广东省",
Address: "奥园",
City: "广州市",
Area: "番禺区",
ConsigneePhone: "15375390426",
ConsigneeContacts: "张三",
LockCode: "L1234567890",
LockCode: "L0123456789",
Source: "AILEHUI",
},
},
@@ -135,8 +135,8 @@ func TestWeiPinShangClient_CreateOrder(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: CreateOrderReq{
LockCode: "L1234567890",
OrderNo: "10000000000",
LockCode: "L0123456789",
OrderNo: "20000000000",
},
},
}
@@ -183,7 +183,9 @@ func TestWeiPinShangClient_GetOrderInfo(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: args{
orderNo: "20250527172503439229",
//orderNo: "20250527172503439229",
//orderNo: "10000000000",
orderNo: "20000000000",
},
},
}
@@ -230,7 +232,8 @@ func TestWeiPinShangClient_GetOrderInfoByItemNO(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: args{
mcOrderNo: "mc20250527174640537475",
//mcOrderNo: "mc20250527174640537475",
mcOrderNo: "mc20250529102347907570",
},
},
}
@@ -277,7 +280,8 @@ func TestWeiPinShangClient_GetOrderInfoByThirdNO(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: args{
orderNo: "10000000000",
//orderNo: "10000000000",
orderNo: "20000000000",
},
},
{
@@ -310,3 +314,171 @@ func TestWeiPinShangClient_GetOrderInfoByThirdNO(t *testing.T) {
})
}
}
func TestWeiPinShangClient_IsRefund(t *testing.T) {
type fields struct {
Host string
ChannelType string
Key string
}
type args struct {
mcOrderNo string
}
tests := []struct {
name string
fields fields
args args
wantRes *IsRefundRes
wantErr bool
}{
{
name: "test1",
fields: fields{
Host: "https://uat.api.weipinshang.net/",
ChannelType: "AILEHUI",
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: args{
mcOrderNo: "mc20250529102347907570",
},
},
}
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.IsRefund(test.args.mcOrderNo)
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) {
type fields struct {
Host string
ChannelType string
Key string
}
tests := []struct {
name string
fields fields
args DeliverGoodsReq
wantRes *TestRes
wantErr bool
}{
{
name: "test1",
fields: fields{
Host: "https://uat.api.weipinshang.net/",
ChannelType: "AILEHUI",
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: DeliverGoodsReq{
COrderItemNo: "mc20250527172503957733",
CDeliveryName: "顺丰",
CDeliveryNo: "1234567890",
},
},
{
name: "test1",
fields: fields{
Host: "https://uat.api.weipinshang.net/",
ChannelType: "AILEHUI",
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: DeliverGoodsReq{
COrderItemNo: "mc20250527172503673418",
CDeliveryName: "京东",
CDeliveryNo: "1234567890",
},
},
}
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.DeliverGoods(&test.args)
log.Println(gotRes, err)
if (err != nil) != test.wantErr {
t.Errorf("GetManyPostage() error = %v, wantErr %v", err, test.wantErr)
}
})
}
}
func TestWeiPinShangClient_UpdateService(t *testing.T) {
type fields struct {
Host string
ChannelType string
Key string
}
tests := []struct {
name string
fields fields
args UpdateServiceReq
wantRes *TestRes
wantErr bool
}{
{
name: "test1",
fields: fields{
Host: "https://uat.api.weipinshang.net/",
ChannelType: "AILEHUI",
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: UpdateServiceReq{
COrderItemNo: "20250527172503439229",
CType: "1",
},
},
{
name: "test1",
fields: fields{
Host: "https://uat.api.weipinshang.net/",
ChannelType: "AILEHUI",
Key: "f654ea5bde7635c3f46191191e5c4c8e",
},
args: UpdateServiceReq{
COrderItemNo: "10000000000",
CType: "2",
},
},
}
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.UpdateService(&test.args)
log.Println(gotRes, err)
if (err != nil) != test.wantErr {
t.Errorf("GetManyPostage() error = %v, wantErr %v", err, test.wantErr)
}
})
}
}