From 9f6802be5f8df9f28b6063116eba7e3342259b23 Mon Sep 17 00:00:00 2001 From: Mufei <327958099@qq.com> Date: Fri, 6 Jun 2025 09:49:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E5=8F=91=E9=80=81=E8=A7=86=E9=A2=91=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E7=BB=93=E6=9E=84=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/request/requestAccountServiceSendMsg.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/work/accountService/message/request/requestAccountServiceSendMsg.go b/src/work/accountService/message/request/requestAccountServiceSendMsg.go index 74530aef..f2f3c791 100644 --- a/src/work/accountService/message/request/requestAccountServiceSendMsg.go +++ b/src/work/accountService/message/request/requestAccountServiceSendMsg.go @@ -8,6 +8,7 @@ type RequestAccountServiceSendMsg struct { Text *RequestAccountServiceMsgText `json:"text,omitempty"` Image *RequestAccountServiceMsgImage `json:"image,omitempty"` Voice *RequestAccountServiceMsgVoice `json:"voice,omitempty"` + Video *RequestAccountServiceMsgVideo `json:"video,omitempty"` File *RequestAccountServiceMsgFile `json:"file,omitempty"` Link *RequestAccountServiceMsgLink `json:"link,omitempty"` MiniProgram *RequestAccountServiceMsgMiniProgram `json:"miniprogram,omitempty"` @@ -28,6 +29,10 @@ type RequestAccountServiceMsgVoice struct { MediaID string `json:"media_id"` } +type RequestAccountServiceMsgVideo struct { + MediaID string `json:"media_id"` +} + type RequestAccountServiceMsgFile struct { MediaID string `json:"media_id"` } From f185f61bce97396105d2f7dd3d0deb2727279a7c Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Fri, 6 Jun 2025 10:54:20 +0800 Subject: [PATCH 2/3] update --- src/work/externalContact/contactWay/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/work/externalContact/contactWay/client.go b/src/work/externalContact/contactWay/client.go index 26853493..303058f0 100644 --- a/src/work/externalContact/contactWay/client.go +++ b/src/work/externalContact/contactWay/client.go @@ -24,7 +24,7 @@ func NewClient(app kernel.ApplicationInterface) (*Client, error) { } // 配置客户联系「联系我」方式. -// https://developer.work.weixin.qq.com/document/path/92572 +// https://developer.work.weixin.qq.com/document/path/92228 func (comp *Client) Add(ctx context.Context, options *request2.RequestAddContactWay) (*response3.ResponseAddContactWay, error) { result := &response3.ResponseAddContactWay{} From 5bfc22af0263743b95aab1cd272dece190e37228 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Fri, 6 Jun 2025 11:12:34 +0800 Subject: [PATCH 3/3] feat(payment): add ElecSign apis --- src/payment/bill/client.go | 2 +- src/payment/fundApp/client.go | 50 +++++++++++++++++++ .../fundApp/response/responseElecSign.go | 28 +++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/payment/fundApp/response/responseElecSign.go diff --git a/src/payment/bill/client.go b/src/payment/bill/client.go index ebd8f6d6..735bcedb 100644 --- a/src/payment/bill/client.go +++ b/src/payment/bill/client.go @@ -59,7 +59,7 @@ func (comp *Client) GetFlowBill(ctx context.Context, date string, accountType st return result, err } -// https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_8.shtml +// https://pay.weixin.qq.com/doc/v3/merchant/4013071238 func (comp *Client) DownloadBill(ctx context.Context, requestDownload *power.RequestDownload, filePath string) (int64, error) { return comp.StreamDownload(ctx, requestDownload, filePath) } diff --git a/src/payment/fundApp/client.go b/src/payment/fundApp/client.go index ebbcddcd..08893ac1 100644 --- a/src/payment/fundApp/client.go +++ b/src/payment/fundApp/client.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/ArtisanCloud/PowerLibs/v3/object" + "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/power" "github.com/ArtisanCloud/PowerWeChat/v3/src/payment/fundApp/request" "github.com/ArtisanCloud/PowerWeChat/v3/src/payment/fundApp/response" payment "github.com/ArtisanCloud/PowerWeChat/v3/src/payment/kernel" @@ -77,3 +78,52 @@ func (comp *Client) Cancel(ctx context.Context, outBillNO string) (*response.Res return result, err } + +// 商户单号申请电子回单 +// https://pay.weixin.qq.com/doc/v3/merchant/4012716452 +func (comp *Client) ApplyForElecSign(ctx context.Context, outBillNO string) (*response.ResponseApplyForElecSign, error) { + + result := &response.ResponseApplyForElecSign{} + + endpoint := "/v3/fund-app/mch-transfer/elecsign/out-bill-no" + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodPost, &object.HashMap{ + "out_bill_no": outBillNO, + }, nil, result) + + return result, err +} + +// 商户单号查询电子回单 +// https://pay.weixin.qq.com/doc/v3/merchant/4012716436 +func (comp *Client) QueryElecSign(ctx context.Context, outBillNO string) (*response.ResponseQueryElecSign, error) { + result := &response.ResponseQueryElecSign{} + endpoint := comp.Wrap(fmt.Sprintf("/v3/fund-app/mch-transfer/elecsign/out-bill-no/%s", outBillNO)) + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodGet, &object.HashMap{}, nil, result) + return result, err +} + +// 微信单号申请电子回单 +// https://pay.weixin.qq.com/doc/v3/merchant/4012716456 +func (comp *Client) ApplyForElecSignByTransferBillNo(ctx context.Context, transferBillNO string) (*response.ResponseApplyForElecSign, error) { + result := &response.ResponseApplyForElecSign{} + endpoint := "/v3/fund-app/mch-transfer/elecsign/transfer-bill-no" + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodPost, &object.HashMap{ + "transfer_bill_no": transferBillNO, + }, nil, result) + return result, err +} + +// 微信单号查询电子回单 +// https://pay.weixin.qq.com/doc/v3/merchant/4012716455 +func (comp *Client) QueryElecSignByTransferBillNo(ctx context.Context, transferBillNO string) (*response.ResponseQueryElecSign, error) { + result := &response.ResponseQueryElecSign{} + endpoint := comp.Wrap(fmt.Sprintf("/v3/fund-app/mch-transfer/elecsign/transfer-bill-no/%s", transferBillNO)) + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodGet, &object.HashMap{}, nil, result) + return result, err +} + +// 下载电子回单 +// https://pay.weixin.qq.com/doc/v3/merchant/4013866774 +func (comp *Client) DownloadElecSignToFilePath(ctx context.Context, requestDownload *power.RequestDownload, filePath string) (int64, error) { + return comp.StreamDownload(ctx, requestDownload, filePath) +} diff --git a/src/payment/fundApp/response/responseElecSign.go b/src/payment/fundApp/response/responseElecSign.go new file mode 100644 index 00000000..d1a7c371 --- /dev/null +++ b/src/payment/fundApp/response/responseElecSign.go @@ -0,0 +1,28 @@ +package response + +import ( + "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/response" + "time" +) + +type ResponseApplyForElecSign struct { + response.ResponsePayment + + State string `json:"state"` + CreateTime time.Time `json:"create_time"` +} + +type ResponseQueryElecSign struct { + State string `json:"state"` + CreateTime time.Time `json:"create_time"` + UpdateTime time.Time `json:"update_time"` + HashType string `json:"hash_type"` + HashValue string `json:"hash_value"` + DownloadUrl string `json:"download_url"` +} + +type RequestDownloadUrl struct { + HashType string `json:"hash_type"` + HashValue string `json:"hash_value"` + DownloadUrl string `json:"download_url"` +}