Compare commits

..

No commits in common. "5574b1ba4e7c8b24074a6aba0ea29116358907b2" and "4c27cecde1c505b7d32c8b2351a17890ac20f017" have entirely different histories.

2 changed files with 10 additions and 66 deletions

View File

@ -5,7 +5,6 @@ import (
"crypto/md5" "crypto/md5"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
@ -298,7 +297,7 @@ func (w *WeiPinShangClient) WPSPost(url string, paramMap map[string]any) (res []
fmt.Printf("res: %s\n", string(res)) fmt.Printf("res: %s\n", string(res))
if !json.Valid(res) { if !json.Valid(res) {
return nil, errors.New("响应体不是有效的JSON格式") return nil, fmt.Errorf("响应不是有效的JSON格式: %s", string(res))
} }
return return

View File

@ -233,7 +233,7 @@ func TestWeiPinShangClient_GetOrderInfoByItemNO(t *testing.T) {
}, },
args: args{ args: args{
//mcOrderNo: "mc20250527174640537475", //mcOrderNo: "mc20250527174640537475",
mcOrderNo: "mc20250616115732440085", mcOrderNo: "mc20250529102347485667",
}, },
}, },
} }
@ -292,7 +292,7 @@ func TestWeiPinShangClient_GetOrderInfoByThirdNO(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e", Key: "f654ea5bde7635c3f46191191e5c4c8e",
}, },
args: args{ args: args{
orderNo: "570872619444771455", orderNo: "20250527172503439229",
}, },
}, },
} }
@ -339,7 +339,7 @@ func TestWeiPinShangClient_IsRefund(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e", Key: "f654ea5bde7635c3f46191191e5c4c8e",
}, },
args: args{ args: args{
mcOrderNo: "mc20250613182629112823", mcOrderNo: "mc20250529102347907570",
}, },
}, },
} }
@ -409,61 +409,6 @@ 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 --------------------------------------------------- // test ---------------------------------------------------
func TestWeiPinShangClient_DeliverGoods(t *testing.T) { func TestWeiPinShangClient_DeliverGoods(t *testing.T) {
@ -488,7 +433,7 @@ func TestWeiPinShangClient_DeliverGoods(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e", Key: "f654ea5bde7635c3f46191191e5c4c8e",
}, },
args: DeliverGoodsReq{ args: DeliverGoodsReq{
COrderItemNo: "mc20250613182629112823", COrderItemNo: "mc20250527172503957733",
CDeliveryName: "顺丰", CDeliveryName: "顺丰",
CDeliveryNo: "1234567890", CDeliveryNo: "1234567890",
}, },
@ -502,9 +447,9 @@ func TestWeiPinShangClient_DeliverGoods(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e", Key: "f654ea5bde7635c3f46191191e5c4c8e",
}, },
args: DeliverGoodsReq{ args: DeliverGoodsReq{
COrderItemNo: "mc20250616113428587322", COrderItemNo: "mc20250530115549372224",
CDeliveryName: "顺丰0", CDeliveryName: "京东",
CDeliveryNo: "SF9900000099", CDeliveryNo: "1234567890",
}, },
}, },
} }
@ -548,7 +493,7 @@ func TestWeiPinShangClient_UpdateService(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e", Key: "f654ea5bde7635c3f46191191e5c4c8e",
}, },
args: UpdateServiceReq{ args: UpdateServiceReq{
COrderItemNo: "mc20250612153935670660", COrderItemNo: "20250527172503439229",
CType: "1", CType: "1",
}, },
}, },
@ -561,7 +506,7 @@ func TestWeiPinShangClient_UpdateService(t *testing.T) {
Key: "f654ea5bde7635c3f46191191e5c4c8e", Key: "f654ea5bde7635c3f46191191e5c4c8e",
}, },
args: UpdateServiceReq{ args: UpdateServiceReq{
COrderItemNo: "mc20250609180246814560", COrderItemNo: "mc20250530172009173148",
CType: "3", CType: "3",
}, },
}, },