Skip to content

Commit

Permalink
2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
klover2 committed Oct 13, 2022
1 parent be7a637 commit c5d37ed
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ try {
|v2.0.2|增加敏感信息加密方法(publicEncrypt)|
|v2.0.3|修复get请求无参时的签名|
|v2.0.4|修复敏感信息加密方法(publicEncrypt)使用微信平台公钥|
|v2.0.5|修复发起商家转账零钱参数wx_serial_no(自定义参数,即http请求头Wechatpay-Serial的值)为可选参数|
## 文档
[v2支付文档](https://pay.weixin.qq.com/wiki/doc/api/index.html)
Expand Down
2 changes: 1 addition & 1 deletion docs/batches_transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const res = await pay.batches_transfer({
batch_remark: '2019年1月深圳分部报销单',
total_amount: 4000000,
total_num: 200,
wx_serial_no: certificate.serial_no,
wx_serial_no: certificate.serial_no, // 当你需要传user_name时 需要传当前参数
transfer_detail_list: [
{
out_detail_no: 'x23zy545Bd5436',
Expand Down
8 changes: 4 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,16 +689,16 @@ class Pay extends Base {
public async batches_transfer(params: BatchesTransfer.Input): Promise<BatchesTransfer.IOutput> {
const url = 'https://api.mch.weixin.qq.com/v3/transfer/batches';
// 请求参数
const _params = Object.assign({
const _params = {
appid: this.appid,
...params,
});
};

const serial_no = _params.wx_serial_no;
const serial_no = _params?.wx_serial_no;
delete _params.wx_serial_no;
const authorization = this.init('POST', url, _params);

return await this.postRequestV2(url, _params, authorization, { 'Wechatpay-Serial': serial_no });
return await this.postRequestV2(url, _params, authorization, { ...(serial_no && { 'Wechatpay-Serial': serial_no }) });
}
/**
* 微信批次单号查询批次单API
Expand Down
4 changes: 2 additions & 2 deletions lib/interface-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export declare namespace BatchesTransfer {
total_num: number;
/** 转账明细列表 */
transfer_detail_list: TransferDetailList[];
/** 微信平台证书序列号 */
wx_serial_no: string;
/** 微信平台证书序列号-Wechatpay-Serial(当有敏感信息加密时,需要当前参数) */
wx_serial_no?: string;
}

export interface DataOutput {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechatpay-node-v3",
"version": "2.0.4",
"version": "2.0.5",
"description": "微信支付文档v3",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit c5d37ed

Please sign in to comment.