diff --git a/plugins/zltx_v2/internal/transform.go b/plugins/zltx_v2/internal/transform.go index 3a4a861..d161165 100644 --- a/plugins/zltx_v2/internal/transform.go +++ b/plugins/zltx_v2/internal/transform.go @@ -22,6 +22,7 @@ type Config struct { type Card struct { Number string `json:"number"` Password string `json:"password"` + Deadline string `json:"deadline"` } func (c *Card) ToJson() []byte { @@ -132,7 +133,9 @@ func queryResp(appKey string, request *proto.QueryRequest, resp *api.OrderQueryR } func getQueryCard(appKey string, card *api.Cards) (*Card, error) { - car := &Card{} + car := &Card{ + Deadline: card.Deadline, + } t := vo.CardType(card.CardType) if t.IsPwdNo() { pwd, err := decryptAES(card.Pwd, appKey) @@ -205,7 +208,9 @@ func getNotifyCard(appKey string, cards []notify.Cards) ([]byte, error) { } card := cards[0] - car := &Card{} + car := &Card{ + Deadline: card.Deadline, + } t := vo.CardType(card.CardType) if t.IsPwdNo() { @@ -230,14 +235,6 @@ func getNotifyCard(appKey string, cards []notify.Cards) ([]byte, error) { car.Password = pwd } else if t.IsUrl() { - //if len(card.No) > 0 { - // no, err := decryptAES(card.No, appKey) - // if err != nil { - // return nil, proto.ErrorResponseFail(err.Error()) - // } - // car.Number = no - //} - if len(card.Url) == 0 { return nil, proto.ErrorResponseFail("url is empty") } diff --git a/plugins/zltx_v2/internal/zltx_v2_test.go b/plugins/zltx_v2/internal/zltx_v2_test.go index 4d70d32..4610e2e 100644 --- a/plugins/zltx_v2/internal/zltx_v2_test.go +++ b/plugins/zltx_v2/internal/zltx_v2_test.go @@ -14,11 +14,12 @@ var zltx = &ZLTXV2Service{} func config() []byte { c := &Config{ - AppId: "23329", - AppKey: "8db16e8cc8363ed4eb4c14f9520bcc32", + AppId: "25891", + AppKey: "83cc38e09560417ad7ea0feaaae9d171", BaseUri: "http://211.137.105.198:17100", NotifyUrl: "https://gateway.dev.cdlsxd.cn/yxh5api/v1/order/direct/notify", } + //{"app_id":"25891","app_key":"83cc38e09560417ad7ea0feaaae9d171","merchant_id":25891} marshal, _ := json.Marshal(c) return marshal } @@ -79,8 +80,8 @@ func TestQuery(t *testing.T) { } func TestNotify(t *testing.T) { - bodyBytes := []byte(`{"tradeStatus":"SUCCESS","orderNo":"731095414466813953","tradeStateDesc":"成功","mchId":23329,"outTradeNo":"test_zltx_v2_7","rechargeAccount":"18666173766","unitPrice":0.1,"attach":""}`) - headerBytes := []byte(`{"Accept-Encoding":["gzip"],"Authorization":["39859e5d71a1e7a9f69a6d00cfe79a7a"],"Connection":["close"],"Content-Length":["186"],"Content-Type":["application/json"],"User-Agent":["GuzzleHttp/6.5.5 curl/7.69.1 PHP/7.2.34"],"X-Envoy-Attempt-Count":["1"],"X-Envoy-External-Address":["120.79.35.82"],"X-Forwarded-Client-Cert":["By=spiffe://cluster.local/ns/gopro/sa/default;Hash=7e17458f89c270f74ca6039bfd8c091de2924d2f95f3e415f9c6f95e67932798;Subject=\"\";URI=spiffe://cluster.local/ns/istio-system/sa/istio-ingressgateway-go"],"X-Forwarded-For":["120.79.35.82, 112.124.3.46"],"X-Forwarded-Proto":["https"],"X-Real-Ip":["112.124.3.46"],"X-Remoteaddr":["172.21.0.1"],"X-Request-Id":["69a03321-e633-466b-808e-7e822232cf12"]}`) + bodyBytes := []byte(`{"tradeStatus":"SUCCESS","orderNo":"C2169720720874659840","tradeStateDesc":"成功","cards":[{"no":"RpHWw3cEhiRW764pFoKVHKRypwZg8Txf0YAW8dE+F7lsrkoUKaAlkYL549lRWp+Q","pwd":"","url":"hei8pdKAWO7aiFHPmtZWg1iTupwk3oXV8QH7IVBtUpoPhFt6wksIiN034wbbe9sOo8Wpl7iOXUVSd50mJdwDknUi8BpitNpODfjjiTt7vTk=","deadline":"2025-09-30 00:00:00","cardType":3}],"mchId":25891,"outTradeNo":"202504031355308910010048","rechargeAccount":"","attach":"","unitPrice":27}`) + headerBytes := []byte(`{"Accept-Encoding":["gzip"],"Authorization":["a4decf2803323a023d187578f85f4d21"],"Connection":["close"],"Content-Length":["442"],"Content-Type":["application/json"],"Lsxd-Api-Proxy":["v2"],"Lsxd-From-System":["card"],"Lsxd-Signature":["bc0eb734101796c5bd1fe72472b406a4"],"Lsxd-Timestamp":["1743659731"],"User-Agent":["Go-http-client/1.1"],"X-Envoy-Attempt-Count":["1"],"X-Forwarded-Client-Cert":["By=spiffe://cluster.local/ns/gopro/sa/default;Hash=4798784d2ecd4218a4b71b4d08737f9714e2dbd508446d916b2999fd22d5811c;Subject=\"\";URI=spiffe://cluster.local/ns/card/sa/default"],"X-Forwarded-For":["112.124.3.46"],"X-Forwarded-Proto":["http"],"X-Real-Ip":["112.124.3.46"],"X-Remoteaddr":["172.18.0.1"],"X-Request-Id":["eab52927-95c8-4e64-9f5c-8a5f2aa339c1"]}`) in := &proto.NotifyRequest{ Config: config(),