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"` +} 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"` } 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{}