|
4 | 4 | "context"
|
5 | 5 | "fmt"
|
6 | 6 | "github.com/ArtisanCloud/PowerLibs/v3/object"
|
| 7 | + "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/power" |
7 | 8 | "github.com/ArtisanCloud/PowerWeChat/v3/src/payment/fundApp/request"
|
8 | 9 | "github.com/ArtisanCloud/PowerWeChat/v3/src/payment/fundApp/response"
|
9 | 10 | payment "github.com/ArtisanCloud/PowerWeChat/v3/src/payment/kernel"
|
@@ -77,3 +78,52 @@ func (comp *Client) Cancel(ctx context.Context, outBillNO string) (*response.Res
|
77 | 78 |
|
78 | 79 | return result, err
|
79 | 80 | }
|
| 81 | + |
| 82 | +// 商户单号申请电子回单 |
| 83 | +// https://pay.weixin.qq.com/doc/v3/merchant/4012716452 |
| 84 | +func (comp *Client) ApplyForElecSign(ctx context.Context, outBillNO string) (*response.ResponseApplyForElecSign, error) { |
| 85 | + |
| 86 | + result := &response.ResponseApplyForElecSign{} |
| 87 | + |
| 88 | + endpoint := "/v3/fund-app/mch-transfer/elecsign/out-bill-no" |
| 89 | + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodPost, &object.HashMap{ |
| 90 | + "out_bill_no": outBillNO, |
| 91 | + }, nil, result) |
| 92 | + |
| 93 | + return result, err |
| 94 | +} |
| 95 | + |
| 96 | +// 商户单号查询电子回单 |
| 97 | +// https://pay.weixin.qq.com/doc/v3/merchant/4012716436 |
| 98 | +func (comp *Client) QueryElecSign(ctx context.Context, outBillNO string) (*response.ResponseQueryElecSign, error) { |
| 99 | + result := &response.ResponseQueryElecSign{} |
| 100 | + endpoint := comp.Wrap(fmt.Sprintf("/v3/fund-app/mch-transfer/elecsign/out-bill-no/%s", outBillNO)) |
| 101 | + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodGet, &object.HashMap{}, nil, result) |
| 102 | + return result, err |
| 103 | +} |
| 104 | + |
| 105 | +// 微信单号申请电子回单 |
| 106 | +// https://pay.weixin.qq.com/doc/v3/merchant/4012716456 |
| 107 | +func (comp *Client) ApplyForElecSignByTransferBillNo(ctx context.Context, transferBillNO string) (*response.ResponseApplyForElecSign, error) { |
| 108 | + result := &response.ResponseApplyForElecSign{} |
| 109 | + endpoint := "/v3/fund-app/mch-transfer/elecsign/transfer-bill-no" |
| 110 | + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodPost, &object.HashMap{ |
| 111 | + "transfer_bill_no": transferBillNO, |
| 112 | + }, nil, result) |
| 113 | + return result, err |
| 114 | +} |
| 115 | + |
| 116 | +// 微信单号查询电子回单 |
| 117 | +// https://pay.weixin.qq.com/doc/v3/merchant/4012716455 |
| 118 | +func (comp *Client) QueryElecSignByTransferBillNo(ctx context.Context, transferBillNO string) (*response.ResponseQueryElecSign, error) { |
| 119 | + result := &response.ResponseQueryElecSign{} |
| 120 | + endpoint := comp.Wrap(fmt.Sprintf("/v3/fund-app/mch-transfer/elecsign/transfer-bill-no/%s", transferBillNO)) |
| 121 | + _, err := comp.SafeRequestV3(ctx, endpoint, nil, http.MethodGet, &object.HashMap{}, nil, result) |
| 122 | + return result, err |
| 123 | +} |
| 124 | + |
| 125 | +// 下载电子回单 |
| 126 | +// https://pay.weixin.qq.com/doc/v3/merchant/4013866774 |
| 127 | +func (comp *Client) DownloadElecSignToFilePath(ctx context.Context, requestDownload *power.RequestDownload, filePath string) (int64, error) { |
| 128 | + return comp.StreamDownload(ctx, requestDownload, filePath) |
| 129 | +} |
0 commit comments