插件调试
This commit is contained in:
parent
c009c63edc
commit
f56ca30040
|
@ -89,9 +89,10 @@ func TestNotify(t *testing.T) {
|
|||
in := &proto.NotifyRequest{
|
||||
Config: config(),
|
||||
Queries: nil,
|
||||
Headers: []byte(`{"Accept-Encoding":["gzip, deflate, br"],"Authorization":["MD5 appid=1,sign=CA2F9A1C822AC95A2E2BF175F7403A93"],"Connection":["close"],"Content-Length":["145"],"Content-Type":["application/json"],"Cookie":[""],"User-Agent":["GuzzleHttp/6.5.5 curl/7.69.1 PHP/7.2.34"],"X-Remoteaddr":["172.21.0.1"]}`),
|
||||
Body: []byte(`{"merchantId":23329,"outTradeNo":"test_plugin_zltx_v1_card_3","tradeNo":"716590229825404929","status":"01","cardCode":"bplpAB7dQzSD9xczvO7WGQ=="}`),
|
||||
Headers: []byte(`{"Authorization":["MD5 appid=1,sign=A419BC9E70FA82CC07030A041A4DEEC1"]}`),
|
||||
Body: []byte(`{"merchantId":23369,"outTradeNo":"202501101143088400010016","tradeNo":"732200443106705409","status":"01","cardCode":"R7UVRxu5Zi8SockCksuZ3w=="}`),
|
||||
}
|
||||
|
||||
t.Run("TestNotify", func(t *testing.T) {
|
||||
got, err := cardService.Notify(context.Background(), in)
|
||||
if !assert.Nil(t, err) {
|
||||
|
|
|
@ -50,7 +50,7 @@ func (c *Config) server() (*core.DctWServer, error) {
|
|||
AppKey: c.AppKey,
|
||||
BaseUri: c.BaseUri,
|
||||
},
|
||||
core.WithDebug(false),
|
||||
core.WithDebug(true),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ func config() []byte {
|
|||
AppKey: "1e2bf7a04b8b1e6be5dc78d04e8639c9",
|
||||
BaseUri: "http://test.openapi.1688sup.cn",
|
||||
NotifyUrl: "https://gateway.dev.cdlsxd.cn/yxh5api/v1/order/direct/notify",
|
||||
MerchantId: 25537,
|
||||
MerchantId: 23329,
|
||||
}
|
||||
//c := &Config{
|
||||
// AppId: "101",
|
||||
|
@ -47,10 +47,10 @@ func TestOrder(t *testing.T) {
|
|||
Account: "18666173766",
|
||||
Quantity: 1,
|
||||
//Extra: []byte(`{"jdCode":"123456"}`), // 京东e卡官方,默认的拓展参数
|
||||
Extra: []byte(`{"jdSmsCode":"123456"}`), // 京东e卡专票,拓展参数
|
||||
//Extra: []byte(`{"jdSmsCode":"123456"}`), // 京东e卡专票,拓展参数
|
||||
},
|
||||
Product: &proto.OrderRequest_Product{
|
||||
ProductNo: "360", // 101 2255
|
||||
ProductNo: "101", // 101 2255 360
|
||||
Extra: []byte(`{}`),
|
||||
},
|
||||
}
|
||||
|
@ -67,8 +67,9 @@ func TestOrder(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestQuery(t *testing.T) {
|
||||
c := config()
|
||||
request := &proto.QueryRequest{
|
||||
Config: config(),
|
||||
Config: c,
|
||||
Order: &proto.QueryRequest_Order{
|
||||
OrderNo: "test_plugin_zltx_v1_direct_1",
|
||||
TradeNo: "",
|
||||
|
@ -76,6 +77,7 @@ func TestQuery(t *testing.T) {
|
|||
Extra: nil,
|
||||
},
|
||||
}
|
||||
t.Logf("%+v\n", c)
|
||||
t.Run("TestQuery", func(t *testing.T) {
|
||||
got, err := srv.Query(context.Background(), request)
|
||||
if err != nil {
|
||||
|
@ -91,8 +93,8 @@ func TestNotify(t *testing.T) {
|
|||
in := &proto.NotifyRequest{
|
||||
Config: config(),
|
||||
Queries: nil,
|
||||
Headers: []byte(`{"Accept-Encoding":["gzip, deflate, br"],"Authorization":["MD5 appid=1,sign=6EF1284331EAC9734715C87FEF59D2EF"],"Connection":["close"],"Content-Length":["146"],"Content-Type":["application/json"],"Cookie":[""],"User-Agent":["GuzzleHttp/6.5.5 curl/7.69.1 PHP/7.2.34"],"X-Remoteaddr":["172.21.0.1"]}`),
|
||||
Body: []byte(`{"merchantId":25537,"outTradeNo":"test_plugin_zltx_v1_direct_2","tradeNo":"716586208482959361","status":"03","rechargeAccount":"583989020@qq.com"}`),
|
||||
Headers: []byte(`{"Authorization":["MD5 appid=1,sign=A419BC9E70FA82CC07030A041A4DEEC1"]}`),
|
||||
Body: []byte(`{"merchantId":23369,"outTradeNo":"202501101143088400010016","tradeNo":"732200443106705409","status":"01","cardCode":"R7UVRxu5Zi8SockCksuZ3w=="}`),
|
||||
}
|
||||
t.Run("TestNotify", func(t *testing.T) {
|
||||
got, err := srv.Notify(context.Background(), in)
|
||||
|
|
Loading…
Reference in New Issue