wxpay-node-v3 4.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 klover
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,198 @@
1
+
2
+
3
+ <p style="text-align: center;">
4
+ <h1 align="center"><a href="javascript:void(0);">wechatpay-node-v3-new</a></h1>
5
+ </p>
6
+
7
+ [![OSCS Status](https://www.oscs1024.com/platform/badge/klover2/wechatpay-node-v3-new-ts.svg?size=small)](https://www.oscs1024.com/project/klover2/wechatpay-node-v3-new-ts?ref=badge_small)
8
+ [![npm version](https://badgen.net/npm/v/wechatpay-node-v3-new)](https://www.npmjs.com/package/wechatpay-node-v3-new)
9
+ [![npm downloads](https://badgen.net/npm/dm/wechatpay-node-v3-new)](https://www.npmjs.com/package/wechatpay-node-v3-new)
10
+ [![contributors](https://img.shields.io/github/contributors/klover2/wechatpay-node-v3-new-ts)](https://github.com/bobby169/wechatpay-node-v3-ts/graphs/contributors)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
+
13
+ # 微信支付v3 支持在ts和js中使用
14
+
15
+ ## 欢迎大家加入一起完善这个api
16
+ ## 前言
17
+ 微信官方在2020-12-25正式开放了[v3](https://pay.weixin.qq.com/wiki/doc/apiv3/index.shtml)版本的接口,相比较旧版本[v2](https://pay.weixin.qq.com/wiki/doc/api/index.html)有了不少改变,例如:
18
+ * 遵循统一的Restful的设计风格
19
+ * 使用JSON作为数据交互的格式,不再使用XML
20
+ * 使用基于非对称密钥的SHA256-RSA的数字签名算法,不再使用MD5或HMAC-SHA256
21
+ * 不再要求HTTPS客户端证书
22
+ * 使用AES-256-GCM,对回调中的关键信息进行加密保护
23
+
24
+ 由于官方文档只支持java和php,所以我在这里使用ts简单的封装了一个版本,支持在js或者ts中使用,后续会更加完善这个npm包,谢谢。
25
+
26
+ ## 使用
27
+ `yarn add wechatpay-node-v3-new@2.1.8`(也可以用npm,请加上版本号,使用正式版本)
28
+
29
+ ```bash
30
+ import WxPay from 'wechatpay-node-v3-new'; // 支持使用require
31
+ import fs from 'fs';
32
+ import request from 'superagent';
33
+
34
+ const pay = new WxPay({
35
+ appid: '直连商户申请的公众号或移动应用appid',
36
+ mchid: '商户号',
37
+ publicKey: fs.readFileSync('./apiclient_cert.pem'), // 公钥
38
+ privateKey: fs.readFileSync('./apiclient_key.pem'), // 秘钥
39
+ });
40
+
41
+ # 这里以h5支付为例
42
+ try {
43
+ # 参数介绍请看h5支付文档 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml
44
+ const params = {
45
+ appid: '直连商户申请的公众号或移动应用appid',
46
+ mchid: '商户号',
47
+ description: '测试',
48
+ out_trade_no: '订单号',
49
+ notify_url: '回调url',
50
+ amount: {
51
+ total: 1,
52
+ },
53
+ scene_info: {
54
+ payer_client_ip: 'ip',
55
+ h5_info: {
56
+ type: 'Wap',
57
+ app_name: '网页名称 例如 百度',
58
+ app_url: '网页域名 例如 https://www.baidu.com',
59
+ },
60
+ },
61
+ };
62
+ const nonce_str = Math.random().toString(36).substr(2, 15), // 随机字符串
63
+ timestamp = parseInt(+new Date() / 1000 + '').toString(), // 时间戳 秒
64
+ url = '/v3/pay/transactions/h5';
65
+
66
+ # 获取签名
67
+ const signature = pay.getSignature('POST', nonce_str, timestamp, url, params); # 如果是get 请求 则不需要params 参数拼接在url上 例如 /v3/pay/transactions/id/12177525012014?mchid=1230000109
68
+ # 获取头部authorization 参数
69
+ const authorization = pay.getAuthorization(nonce_str, timestamp, signature);
70
+
71
+ const result = await request
72
+ .post('https://api.mch.weixin.qq.com/v3/pay/transactions/h5')
73
+ .send(params)
74
+ .set({
75
+ Accept: 'application/json',
76
+ 'Content-Type': 'application/json',
77
+ 'User-Agent':
78
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
79
+ Authorization: authorization,
80
+ });
81
+
82
+ console.log('result==========>', result.body);
83
+ } catch (error) {
84
+ console.log(error);
85
+ }
86
+ ```
87
+ 如果你使用的是nest框架,请结合`nest-wechatpay-node-v3-new`一起使用。
88
+
89
+ ## 使用自定义 http 请求
90
+ > import { IPayRequest, Output } from 'wechatpay-node-v3-new/dist/define';
91
+
92
+ 自己实现 `IPayRequest` 接口,使用如下方法注入
93
+
94
+ ```ts
95
+ pay.createHttp(...);
96
+ ```
97
+
98
+
99
+ ## WxPay 介绍
100
+ `import WxPay from 'wechatpay-node-v3-new';` 或者 `const WxPay = require('wechatpay-node-v3-new')`
101
+
102
+ 参数介绍
103
+ |参数名称 |参数介绍 |是否必须|
104
+ |--|--|--|
105
+ | appid| 直连商户申请的公众号或移动应用appid|是|
106
+ |mchid|商户号|是
107
+ |serial_no|证书序列号|否|
108
+ |publicKey|公钥|是|
109
+ |privateKey|密钥|是|
110
+ |authType|认证类型,目前为WECHATPAY2-SHA256-RSA2048|否|
111
+ |userAgent|自定义User-Agent|否|
112
+ |key|APIv3密钥|否 有验证回调必须|
113
+
114
+ ## 注意
115
+ 1. serial_no是证书序列号 请在命令窗口使用 `openssl x509 -in apiclient_cert.pem -noout -serial` 获取
116
+ 2. 头部参数需要添加 User-Agent 参数
117
+ 3. 需要在商户平台设置APIv3密钥才会有回调,详情参看文档指引http://kf.qq.com/faq/180830E36vyQ180830AZFZvu.html
118
+
119
+ ## 使用介绍
120
+ 以下函数是我针对微信相关接口进行进一步封装,可以直接使用。
121
+ | api名称 | 函数名 |
122
+ |--|--|
123
+ | [h5支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml) |[transactions_h5](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_h5.md) |
124
+ | [native支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml) |[transactions_native](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_native.md) |
125
+ | [app支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_1.shtml) |[transactions_app](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_app.md) |
126
+ | [JSAPI支付 或者 小程序支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml) |[transactions_jsapi](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_jsapi.md) |
127
+ | [查询订单](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml) |[query](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/query.md) |
128
+ | [关闭订单](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml) |[close](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/close.md) |
129
+ | [申请交易账单](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_6.shtml) |[tradebill](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/tradebill.md) |
130
+ | [申请资金账单](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_7.shtml) |[fundflowbill](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/fundflowbill.md) |
131
+ | [下载账单](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_8.shtml) |[downloadBill](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/downloadbill.md) |
132
+ | [回调解密](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_5.shtml) |[decipher_gcm](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_h5.md) |
133
+ |[合单h5支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_2.shtml)|[combine_transactions_h5](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/combine.md)|
134
+ |[合单native支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_5.shtml)|[combine_transactions_native](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/combine.md)|
135
+ |[合单app支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_1.shtml)|[combine_transactions_app](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/combine.md)|
136
+ |[合单JSAPI支付 或者 小程序支付](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_3.shtml)|[combine_transactions_jsapi](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/combine.md)|
137
+ |[查询合单](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_11.shtml)|[combine_query](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/combine.md)|
138
+ |[关闭合单](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_12.shtml)|[combine_close](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/combine.md)|
139
+ |[获取序列号]()|[getSN](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_h5.md)|
140
+ |[申请退款](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_9.shtml)|[refunds](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_h5.md)|
141
+ |[查询退款](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_10.shtml)|[find_refunds](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transactions_h5.md)|
142
+ |[签名验证](https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_1.shtml)|[verifySign](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/verifySign.md)|
143
+ |[微信提现到零钱](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_1.shtml)|[batches_transfer](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/batches_transfer.md)|
144
+ |[分账](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_1.shtml)|[create_profitsharing_orders](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/profitsharing.md)|
145
+ |[用户确认模式,发起商家转账](https://pay.weixin.qq.com/doc/v3/merchant/4012716434)|[transfer_bills](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transfer_bills.md)|
146
+ |[用户确认模式,撤销转账](https://pay.weixin.qq.com/doc/v3/merchant/4012716458)|[transfer_bills](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transfer_bills.md)|
147
+ |[用户确认模式,商户单号查询转账单](https://pay.weixin.qq.com/doc/v3/merchant/4012716437)|[transfer_bills](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transfer_bills.md)|
148
+ |[用户确认模式,微信单号查询转账单](https://pay.weixin.qq.com/doc/v3/merchant/4012716457)|[transfer_bills](https://github.com/bobby169/wechatpay-node-v3-ts/blob/master/docs/transfer_bills.md)|
149
+ ## 版本介绍
150
+ | 版本号 | 版本介绍 |
151
+ |--|--|
152
+ | v0.0.1 | 仅支持签名和获取头部参数Authorization |
153
+ |v1.0.0|增加了支付(不包括合单支付)、查询订单、关闭订单、申请交易账单、申请资金账单、下载账单|
154
+ |v1.2.0|增加了回调解密,合单支付、合单关闭、合单查询|
155
+ |v1.2.1|修改app、jsapi、native支付字段scene_info 改为可选|
156
+ |v1.2.2|增加获取序列号方法|
157
+ |v1.2.3|修改小程序支付签名错误和取消serial_no字段必填|
158
+ |v1.3.0|增加普通订单的退款和查询|
159
+ |v1.3.1|修复APP调起支付时出现“支付验证签名失败“的问题|
160
+ |v1.3.2|增加请求成功后的签名验证|
161
+ |v1.3.3|修复superagent post请求异常 Z_DATA_ERROR|
162
+ |v1.3.4|修复superagent get请求异常 Z_DATA_ERROR|
163
+ |v1.3.5|修复APP支付签名错误|
164
+ |v2.0.0|增加提现到零钱和优化接口参数,规定返回参数格式,其他接口会后续优化|
165
+ |v2.0.1|增加请求头Wechatpay-Serial和完善转账其他接口|
166
+ |v2.0.2|增加敏感信息加密方法(publicEncrypt)|
167
+ |v2.0.3|修复get请求无参时的签名|
168
+ |v2.0.4|修复敏感信息加密方法(publicEncrypt)使用微信平台公钥|
169
+ |v2.0.6|修复发起商家转账零钱参数wx_serial_no(自定义参数,即http请求头Wechatpay-Serial的值)为可选参数|
170
+ |v2.1.0|升级superagent依赖6.1.0到8.0.6|
171
+ |v2.1.1|商家转账API支持场景参数|
172
+ |v2.1.2|基础支付接口支持传appid|
173
+ |v2.1.3|支持分账相关接口|
174
+ |v2.1.4|修复错误原因存在空值bug|
175
+ |v2.1.5|修复动态 appid 签名错误|
176
+ |v2.1.6|Native下单API支持support_fapiao字段|
177
+ |v2.1.7|修复退款接口refunds和find_refunds返回结果中的http status会被业务status覆盖问题|
178
+ |v2.1.8|修复回调签名key错误|
179
+ |v2.2.0|修复回调解密报Unsupported state or unable to authenticate data |
180
+ |v2.2.1|上传图片 |
181
+ |v3.0.0|增家商家转账用户确认模式
182
+ ||v4.0.4|修复transfer_cancel接口参数错误,导致验签失败
183
+
184
+ ## 文档
185
+ [v2支付文档](https://pay.weixin.qq.com/wiki/doc/api/index.html)
186
+ [v3支付文档](https://pay.weixin.qq.com/wiki/doc/apiv3/index.shtml)
187
+ [商家转账用户确认模式](https://pay.weixin.qq.com/doc/v3/merchant/4012711988)
188
+
189
+
190
+ ## 贡献
191
+ <a href="https://github.com/bobby169/wechatpay-node-v3-ts/graphs/contributors">
192
+ <img src="https://contrib.rocks/image?repo=klover2/wechatpay-node-v3-new-ts" />
193
+ </a>
194
+
195
+ 欢迎提[存在的Bug或者意见](https://github.com/bobby169/wechatpay-node-v3-ts/issues)。
196
+
197
+
198
+
@@ -0,0 +1,2 @@
1
+ export * from './lib/pay-request.interface';
2
+ export { Output } from './lib/interface-v2';
package/dist/define.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./lib/pay-request.interface"), exports);
@@ -0,0 +1,305 @@
1
+ /// <reference types="node" />
2
+ import { Ipay, Ih5, Inative, Ijsapi, Iquery1, Iquery2, Itradebill, Ifundflowbill, Iapp, Ioptions, Irefunds1, Irefunds2, ICertificates } from './lib/interface';
3
+ import { IcombineH5, IcombineNative, IcombineApp, IcombineJsapi, IcloseSubOrders } from './lib/combine_interface';
4
+ import { BatchesTransfer, FindRefunds, ProfitSharing, Refunds, UploadImages } from './lib/interface-v2';
5
+ import { TransferBills } from './lib/interface-v3';
6
+ import { Base } from './lib/base';
7
+ import { IPayRequest } from './lib/pay-request.interface';
8
+ declare class Pay extends Base {
9
+ protected appid: string;
10
+ protected mchid: string;
11
+ protected serial_no: string;
12
+ protected publicKey?: Buffer;
13
+ protected privateKey?: Buffer;
14
+ protected authType: string;
15
+ protected httpService: IPayRequest;
16
+ protected key?: string;
17
+ protected static certificates: {
18
+ [key in string]: string;
19
+ };
20
+ /**
21
+ * 构造器
22
+ * @param appid 直连商户申请的公众号或移动应用appid。
23
+ * @param mchid 商户号
24
+ * @param publicKey 公钥
25
+ * @param privateKey 密钥
26
+ * @param options 可选参数 object 包括下面参数
27
+ *
28
+ * @param serial_no 证书序列号
29
+ * @param authType 可选参数 认证类型,目前为WECHATPAY2-SHA256-RSA2048
30
+ * @param userAgent 可选参数 User-Agent
31
+ * @param key 可选参数 APIv3密钥
32
+ */
33
+ constructor(appid: string, mchid: string, publicKey: Buffer, privateKey: Buffer, options?: Ioptions);
34
+ /**
35
+ * 构造器
36
+ * @param obj object类型 包括下面参数
37
+ *
38
+ * @param appid 直连商户申请的公众号或移动应用appid。
39
+ * @param mchid 商户号
40
+ * @param serial_no 可选参数 证书序列号
41
+ * @param publicKey 公钥
42
+ * @param privateKey 密钥
43
+ * @param authType 可选参数 认证类型,目前为WECHATPAY2-SHA256-RSA2048
44
+ * @param userAgent 可选参数 User-Agent
45
+ * @param key 可选参数 APIv3密钥
46
+ */
47
+ constructor(obj: Ipay);
48
+ /**
49
+ * 自定义创建http 请求
50
+ */
51
+ createHttp(service: IPayRequest): void;
52
+ /**
53
+ * 获取微信平台key
54
+ * @param apiSecret APIv3密钥
55
+ * @returns
56
+ */
57
+ get_certificates(apiSecret: string): Promise<ICertificates[]>;
58
+ /**
59
+ * 拉取平台证书到 Pay.certificates 中
60
+ * @param apiSecret APIv3密钥
61
+ * https://pay.weixin.qq.com/wiki/doc/apiv3/apis/wechatpay5_1.shtml
62
+ */
63
+ private fetchCertificates;
64
+ /**
65
+ * 验证签名,提醒:node 取头部信息时需要用小写,例如:req.headers['wechatpay-timestamp']
66
+ * @param params.timestamp HTTP头Wechatpay-Timestamp 中的应答时间戳
67
+ * @param params.nonce HTTP头Wechatpay-Nonce 中的应答随机串
68
+ * @param params.body 应答主体(response Body),需要按照接口返回的顺序进行验签,错误的顺序将导致验签失败。
69
+ * @param params.serial HTTP头Wechatpay-Serial 证书序列号
70
+ * @param params.signature HTTP头Wechatpay-Signature 签名
71
+ * @param params.apiSecret APIv3密钥,如果在 构造器 中有初始化该值(this.key),则可以不传入。当然传入也可以
72
+ */
73
+ verifySign(params: {
74
+ timestamp: string | number;
75
+ nonce: string;
76
+ body: Record<string, any> | string;
77
+ serial: string;
78
+ signature: string;
79
+ apiSecret?: string;
80
+ }): Promise<boolean>;
81
+ /**
82
+ * 敏感信息加密
83
+ * @param str 敏感信息字段(如用户的住址、银行卡号、手机号码等)
84
+ * @returns
85
+ */
86
+ publicEncrypt(str: string, wxPublicKey: Buffer, padding?: number): string;
87
+ /**
88
+ * 敏感信息解密
89
+ * @param str 敏感信息字段(如用户的住址、银行卡号、手机号码等)
90
+ * @returns
91
+ */
92
+ privateDecrypt(str: string, padding?: number): string;
93
+ /**
94
+ * 构建请求签名参数
95
+ * @param method Http 请求方式
96
+ * @param url 请求接口 例如/v3/certificates
97
+ * @param timestamp 获取发起请求时的系统当前时间戳
98
+ * @param nonceStr 随机字符串
99
+ * @param body 请求报文主体
100
+ */
101
+ getSignature(method: string, nonce_str: string, timestamp: string, url: string, body?: string | Record<string, any>): string;
102
+ protected sign(str: string): string;
103
+ getSN(fileData?: string | Buffer): string;
104
+ /**
105
+ * SHA256withRSA
106
+ * @param data 待加密字符
107
+ * @param privatekey 私钥key key.pem fs.readFileSync(keyPath)
108
+ */
109
+ sha256WithRsa(data: string): string;
110
+ /**
111
+ * 获取授权认证信息
112
+ * @param nonceStr 请求随机串
113
+ * @param timestamp 时间戳
114
+ * @param signature 签名值
115
+ */
116
+ getAuthorization(nonce_str: string, timestamp: string, signature: string): string;
117
+ /**
118
+ * 回调解密
119
+ * @param ciphertext Base64编码后的开启/停用结果数据密文
120
+ * @param associated_data 附加数据
121
+ * @param nonce 加密使用的随机串
122
+ * @param key APIv3密钥
123
+ */
124
+ decipher_gcm<T extends any>(ciphertext: string, associated_data: string, nonce: string, key?: string): T;
125
+ /**
126
+ * 参数初始化
127
+ */
128
+ protected buildAuthorization(method: string, url: string, params?: Record<string, any>): string;
129
+ /**
130
+ * h5支付
131
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml
132
+ */
133
+ transactions_h5(params: Ih5): Promise<import("./lib/interface-v2").Output>;
134
+ /**
135
+ * 合单h5支付
136
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_2.shtml
137
+ */
138
+ combine_transactions_h5(params: IcombineH5): Promise<import("./lib/interface-v2").Output>;
139
+ /**
140
+ * native支付
141
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml
142
+ */
143
+ transactions_native(params: Inative): Promise<import("./lib/interface-v2").Output>;
144
+ /**
145
+ * 合单native支付
146
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_5.shtml
147
+ */
148
+ combine_transactions_native(params: IcombineNative): Promise<import("./lib/interface-v2").Output>;
149
+ /**
150
+ * app支付
151
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_1.shtml
152
+ */
153
+ transactions_app(params: Iapp): Promise<import("./lib/interface-v2").Output>;
154
+ /**
155
+ * 合单app支付
156
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_1.shtml
157
+ */
158
+ combine_transactions_app(params: IcombineApp): Promise<import("./lib/interface-v2").Output>;
159
+ /**
160
+ * JSAPI支付 或者 小程序支付
161
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml
162
+ */
163
+ transactions_jsapi(params: Ijsapi): Promise<import("./lib/interface-v2").Output>;
164
+ /**
165
+ * 合单JSAPI支付 或者 小程序支付
166
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_3.shtml
167
+ */
168
+ combine_transactions_jsapi(params: IcombineJsapi): Promise<import("./lib/interface-v2").Output>;
169
+ /**
170
+ * 查询订单
171
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_2.shtml
172
+ */
173
+ query(params: Iquery1 | Iquery2): Promise<import("./lib/interface-v2").Output>;
174
+ /**
175
+ * 合单查询订单
176
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_11.shtml
177
+ */
178
+ combine_query(combine_out_trade_no: string): Promise<import("./lib/interface-v2").Output>;
179
+ /**
180
+ * 关闭订单
181
+ * @param out_trade_no 请求参数 商户订单号 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_3.shtml
182
+ */
183
+ close(out_trade_no: string): Promise<import("./lib/interface-v2").Output>;
184
+ /**
185
+ * 合单关闭订单
186
+ * @param combine_out_trade_no 请求参数 总订单号 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_12.shtml
187
+ * @param sub_orders array 子单信息
188
+ */
189
+ combine_close(combine_out_trade_no: string, sub_orders: IcloseSubOrders[]): Promise<import("./lib/interface-v2").Output>;
190
+ /**
191
+ * 申请交易账单
192
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_6.shtml
193
+ */
194
+ tradebill(params: Itradebill): Promise<import("./lib/interface-v2").Output>;
195
+ /**
196
+ * 申请资金账单
197
+ * @param params 请求参数 object 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_7.shtml
198
+ */
199
+ fundflowbill(params: Ifundflowbill): Promise<import("./lib/interface-v2").Output>;
200
+ /**
201
+ * 下载账单
202
+ * @param download_url 请求参数 路径 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_8.shtml
203
+ */
204
+ downloadBill(download_url: string): Promise<import("./lib/interface-v2").Output>;
205
+ /**
206
+ * 申请退款
207
+ * @param params 请求参数 路径 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_9.shtml
208
+ */
209
+ refunds(params: Irefunds1 | Irefunds2): Promise<Refunds.IOutput>;
210
+ /**
211
+ * 查询单笔退款
212
+ * @documentation 请求参数 路径 参数介绍 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_10.shtml
213
+ */
214
+ find_refunds(out_refund_no: string): Promise<FindRefunds.IOutput>;
215
+ /**
216
+ * 发起商家转账零钱
217
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_1.shtml
218
+ */
219
+ batches_transfer(params: BatchesTransfer.Input): Promise<BatchesTransfer.IOutput>;
220
+ /**
221
+ * 微信批次单号查询批次单API
222
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_2.shtml
223
+ */
224
+ query_batches_transfer_list_wx(params: BatchesTransfer.QueryBatchesTransferByWx.Input): Promise<BatchesTransfer.QueryBatchesTransferByWx.IOutput>;
225
+ /**
226
+ * 微信明细单号查询明细单API
227
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_3.shtml
228
+ */
229
+ query_batches_transfer_detail_wx(params: BatchesTransfer.QueryBatchesTransferDetailByWx.Input): Promise<BatchesTransfer.QueryBatchesTransferDetailByWx.IOutput>;
230
+ /**
231
+ * 商家批次单号查询批次单API
232
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_5.shtml
233
+ */
234
+ query_batches_transfer_list(params: BatchesTransfer.QueryBatchesTransferList.Input): Promise<BatchesTransfer.QueryBatchesTransferList.IOutput>;
235
+ /**
236
+ * 商家明细单号查询明细单API
237
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_6.shtml
238
+ */
239
+ query_batches_transfer_detail(params: BatchesTransfer.QueryBatchesTransferDetail.Input): Promise<BatchesTransfer.QueryBatchesTransferDetail.IOutput>;
240
+ /**
241
+ * 请求分账API
242
+ * @param params
243
+ * @returns
244
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_1.shtml
245
+ */
246
+ create_profitsharing_orders(params: ProfitSharing.CreateProfitSharingOrders.Input): Promise<ProfitSharing.CreateProfitSharingOrders.IOutput>;
247
+ /**
248
+ * 查询分账结果API
249
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml
250
+ */
251
+ query_profitsharing_orders(transaction_id: string, out_order_no: string): Promise<ProfitSharing.CreateProfitSharingOrders.IOutput>;
252
+ /**
253
+ * 请求分账回退API
254
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_3.shtml
255
+ */
256
+ profitsharing_return_orders(params: ProfitSharing.ProfitSharingReturnOrders.Input): Promise<ProfitSharing.ProfitSharingReturnOrders.IOutput>;
257
+ /**
258
+ * 查询分账回退结果API
259
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_4.shtml
260
+ */
261
+ query_profitsharing_return_orders(out_return_no: string, out_order_no: string): Promise<ProfitSharing.ProfitSharingReturnOrders.IOutput>;
262
+ /**
263
+ * 解冻剩余资金API
264
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_5.shtml
265
+ */
266
+ profitsharing_orders_unfreeze(params: ProfitSharing.ProfitsharingOrdersUnfreeze.Input): Promise<ProfitSharing.ProfitsharingOrdersUnfreeze.IOutput>;
267
+ /**
268
+ * 查询剩余待分金额API
269
+ * @documentation 请看文档https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_6.shtml
270
+ */
271
+ query_profitsharing_amounts(transaction_id: string): Promise<ProfitSharing.QueryProfitSharingAmounts.IOutput>;
272
+ /**
273
+ * 添加分账接收方API
274
+ * @documentation https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_8.shtml
275
+ */
276
+ profitsharing_receivers_add(params: ProfitSharing.ProfitSharingReceiversAdd.Input): Promise<ProfitSharing.ProfitSharingReceiversAdd.IOutput>;
277
+ /**
278
+ * 删除分账接收方API
279
+ * @documentation https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_9.shtml
280
+ */
281
+ profitsharing_receivers_delete(params: ProfitSharing.ProfitSharingReceiversDelete.Input): Promise<ProfitSharing.ProfitSharingReceiversDelete.IOutput>;
282
+ /**
283
+ * 申请分账账单API
284
+ * @documentation https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_11.shtml
285
+ */
286
+ profitsharing_bills(bill_date: string, tar_type?: string): Promise<ProfitSharing.ProfitSharingBills.IOutput>;
287
+ upload_images(pic_buffer: Buffer, filename: string): Promise<UploadImages.IOutput>;
288
+ /**
289
+ * 商家转账用户确认模式下,用户申请收款时,商户可通过此接口申请创建转账单
290
+ */
291
+ transfer_bills(params: TransferBills.Input): Promise<TransferBills.IOutput>;
292
+ /**
293
+ * 商户通过转账接口发起付款后,在用户确认收款之前可以通过该接口撤销付款
294
+ */
295
+ transfer_cancel(params: TransferBills.CancelInput): Promise<TransferBills.CancelOutput>;
296
+ /**
297
+ * 商家转账用户确认模式下,根据商户单号查询转账单的详细信息
298
+ */
299
+ transfer_out_bill_no(params: TransferBills.OutBillNoInput): Promise<TransferBills.BillOutput>;
300
+ /**
301
+ * 商家转账用户确认模式下,根据微信转账单号查询转账单的详细信息
302
+ */
303
+ transfer_bill_no(params: TransferBills.BillNoInput): Promise<TransferBills.BillOutput>;
304
+ }
305
+ export = Pay;