Skip to content

Develop #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/payment/bill/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
50 changes: 50 additions & 0 deletions src/payment/fundApp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
28 changes: 28 additions & 0 deletions src/payment/fundApp/response/responseElecSign.go
Original file line number Diff line number Diff line change
@@ -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"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion src/work/externalContact/contactWay/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down