From de3c82cbff8fc8c24b416de2ef0b1555f5912e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=8E=E7=82=9C=20=E5=8D=A2?= <307958040@qq.com> Date: Tue, 4 Jun 2024 10:09:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Epay=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B7=A5=E5=8D=95=E5=9B=BE=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=8E=A5=E5=8F=A3=E3=80=81=E5=9B=9E=E5=A4=8D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E3=80=81=E5=AE=8C=E6=88=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pay/client.go | 56 ++++++++++++++++++++++++++++++ services/pay/client_test.go | 27 ++++++++++++++ services/pay/complaint_complete.go | 34 ++++++++++++++++++ services/pay/complaint_reply.go | 36 +++++++++++++++++++ services/pay/complaint_upload.go | 35 +++++++++++++++++++ 5 files changed, 188 insertions(+) create mode 100644 services/pay/client.go create mode 100644 services/pay/client_test.go create mode 100644 services/pay/complaint_complete.go create mode 100644 services/pay/complaint_reply.go create mode 100644 services/pay/complaint_upload.go diff --git a/services/pay/client.go b/services/pay/client.go new file mode 100644 index 0000000..04f2e39 --- /dev/null +++ b/services/pay/client.go @@ -0,0 +1,56 @@ +package pay + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" +) + +const ( + VERSION = "2024-06-03" +) + +var HOST requests.Host = requests.Host{ + Default: "pay.gaore.com", + Func: func(s string) string { + var a = map[string]string{ + requests.RELEASE: "pay.gaore.com", + requests.PRE: "pay.gaore.com", + requests.TEST: "pay.gaore.com", + } + return a[s] + }, +} + +type Client struct { + sdk.Client +} + +func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) { + client = &Client{} + err = client.InitWithAccessKey(accesskey, secrect, source) + return +} + +func NewClientWithAliAppcode(accesskey, secrect string, env ...string) (client *Client, err error) { + client = &Client{} + err = client.InitWithAliAppcode(accesskey, secrect, env...) + return +} + +func (c *Client) ComplaintReply(req *ComplaintReplyRequest) (response *ComplaintReplyResponse, err error) { + response = CreateComplaintReplyResponse() + err = c.DoAction(req, response) + return +} + +func (c *Client) ComplaintComplete(req *ComplaintCompleteRequest) (response *ComplaintCompleteResponse, err error) { + response = CreateComplaintCompleteResponse() + err = c.DoAction(req, response) + return +} + +func (c *Client) ComplaintUpload(req *ComplaintUploadRequest) (response *ComplaintUploadResponse, err error) { + response = CreateComplaintUploadResponse() + err = c.DoAction(req, response) + return +} diff --git a/services/pay/client_test.go b/services/pay/client_test.go new file mode 100644 index 0000000..c92c103 --- /dev/null +++ b/services/pay/client_test.go @@ -0,0 +1,27 @@ +package pay + +import ( + "fmt" + "log" + "testing" +) + +func TestClient_GetUserInfo(t *testing.T) { + + c, err := NewClientWithAliAppcode("", "") + if err != nil { + t.Error(err) + } + + req := CreateComplaintUploadRequest() + + req.MchId = "3503" + req.ImageUrl = "https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64" + + resp, err := c.ComplaintUpload(req) + if err != nil { + log.Fatalln(err) + } + fmt.Println(resp.GetHttpContentString()) + fmt.Println(resp.GetHttpHeaders()) +} diff --git a/services/pay/complaint_complete.go b/services/pay/complaint_complete.go new file mode 100644 index 0000000..4cb43cd --- /dev/null +++ b/services/pay/complaint_complete.go @@ -0,0 +1,34 @@ +package pay + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type ComplaintCompleteRequest struct { + *requests.RpcRequest + MchId string `position:"Body" field:"mch_id" default:"" ` + ComplaintId string `position:"Body" field:"complaint_id" default:"" ` +} + +type ComplaintCompleteResponse struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` +} + +func CreateComplaintCompleteRequest() (req *ComplaintCompleteRequest) { + req = &ComplaintCompleteRequest{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, "/api/complaint/wxComplaintComplete") + req.Method = requests.POST + return +} + +func CreateComplaintCompleteResponse() (response *ComplaintCompleteResponse) { + response = &ComplaintCompleteResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/services/pay/complaint_reply.go b/services/pay/complaint_reply.go new file mode 100644 index 0000000..566dbef --- /dev/null +++ b/services/pay/complaint_reply.go @@ -0,0 +1,36 @@ +package pay + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type ComplaintReplyRequest struct { + *requests.RpcRequest + MchId string `position:"Body" field:"mch_id" default:"" ` + ComplaintId string `position:"Body" field:"complaint_id" default:"" ` + Content string `position:"Body" field:"content" default:"" ` + Images string `position:"Body" field:"images" default:"" ` +} + +type ComplaintReplyResponse struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` +} + +func CreateComplaintReplyRequest() (req *ComplaintReplyRequest) { + req = &ComplaintReplyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, "/api/complaint/wxComplaintReply") + req.Method = requests.POST + return +} + +func CreateComplaintReplyResponse() (response *ComplaintReplyResponse) { + response = &ComplaintReplyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/services/pay/complaint_upload.go b/services/pay/complaint_upload.go new file mode 100644 index 0000000..8b0f67f --- /dev/null +++ b/services/pay/complaint_upload.go @@ -0,0 +1,35 @@ +package pay + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type ComplaintUploadRequest struct { + *requests.RpcRequest + MchId string `position:"Body" field:"mch_id" default:"" ` + ImageUrl string `position:"Body" field:"image_url" default:"" ` +} + +type ComplaintUploadResponse struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data map[string]string `json:"data"` +} + +func CreateComplaintUploadRequest() (req *ComplaintUploadRequest) { + req = &ComplaintUploadRequest{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, "/api/complaint/wxComplaintUpload") + req.Method = requests.POST + return +} + +func CreateComplaintUploadResponse() (response *ComplaintUploadResponse) { + response = &ComplaintUploadResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +}