From f56ca30040d367e6fad451d7a668a2fbdb54ca2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AD=90=E9=93=AD?= Date: Mon, 13 Jan 2025 10:04:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/zltx_card_v1/internal/zltx_card_v1_test.go | 5 +++-- plugins/zltx_v1/internal/transform.go | 2 +- plugins/zltx_v1/internal/zltx_v1_test.go | 14 ++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins/zltx_card_v1/internal/zltx_card_v1_test.go b/plugins/zltx_card_v1/internal/zltx_card_v1_test.go index 46be145..0ca88c0 100644 --- a/plugins/zltx_card_v1/internal/zltx_card_v1_test.go +++ b/plugins/zltx_card_v1/internal/zltx_card_v1_test.go @@ -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) { diff --git a/plugins/zltx_v1/internal/transform.go b/plugins/zltx_v1/internal/transform.go index 393f018..b6b6d6b 100644 --- a/plugins/zltx_v1/internal/transform.go +++ b/plugins/zltx_v1/internal/transform.go @@ -50,7 +50,7 @@ func (c *Config) server() (*core.DctWServer, error) { AppKey: c.AppKey, BaseUri: c.BaseUri, }, - core.WithDebug(false), + core.WithDebug(true), ) } diff --git a/plugins/zltx_v1/internal/zltx_v1_test.go b/plugins/zltx_v1/internal/zltx_v1_test.go index 5fbfda1..be0968f 100644 --- a/plugins/zltx_v1/internal/zltx_v1_test.go +++ b/plugins/zltx_v1/internal/zltx_v1_test.go @@ -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)