7
0

Merge remote-tracking branch 'origin/master'

This commit is contained in:
余 欣怀 2024-07-17 14:50:53 +08:00
commit 4a37a5aa14
6 changed files with 225 additions and 0 deletions

56
services/pay/client.go Normal file
View File

@ -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 NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
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
}
func (c *Client) ComplaintNotifyUrl(req *ComplaintNotifyUrlRequest) (response *ComplaintNotifyUrlResponse, err error) {
response = CreateComplaintNotifyUrlResponse()
err = c.DoAction(req, response)
return
}

View File

@ -0,0 +1,28 @@
package pay
import (
"fmt"
"log"
"testing"
)
func TestClient_GetUserInfo(t *testing.T) {
c, err := NewClient()
if err != nil {
t.Error(err)
}
req := CreateComplaintNotifyUrlRequest()
req.MchId = "3503"
req.NotifyUrl = "https://pay.uu89.com/api/complaint/wxNotify/3503"
req.Type = 1
resp, err := c.ComplaintNotifyUrl(req)
if err != nil {
log.Fatalln(err)
}
fmt.Println(resp.GetHttpContentString())
fmt.Println(resp.GetHttpHeaders())
}

View File

@ -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/complete")
req.Method = requests.POST
return
}
func CreateComplaintCompleteResponse() (response *ComplaintCompleteResponse) {
response = &ComplaintCompleteResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -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 ComplaintNotifyUrlRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
NotifyUrl string `position:"Body" field:"notify_url" default:"" `
Type int `position:"Body" field:"type" default:""`
}
type ComplaintNotifyUrlResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
}
func CreateComplaintNotifyUrlRequest() (req *ComplaintNotifyUrlRequest) {
req = &ComplaintNotifyUrlRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/createWxNotifyUrl")
req.Method = requests.POST
return
}
func CreateComplaintNotifyUrlResponse() (response *ComplaintNotifyUrlResponse) {
response = &ComplaintNotifyUrlResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -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/reply")
req.Method = requests.POST
return
}
func CreateComplaintReplyResponse() (response *ComplaintReplyResponse) {
response = &ComplaintReplyResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -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 ComplaintUploadRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
ImageUrl string `position:"Body" field:"image_url" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" 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/imageUpload")
req.Method = requests.POST
return
}
func CreateComplaintUploadResponse() (response *ComplaintUploadResponse) {
response = &ComplaintUploadResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}