Skip to content

Commit

Permalink
bump to 0.8.8
Browse files Browse the repository at this point in the history
dependencies upgrading on axios@0.21.2-0.27, xml2js@0.5-0.6
  • Loading branch information
TheNorthMemory committed Jan 28, 2024
1 parent 52f61f3 commit 75fd266
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ The WeChatPay OpenAPI v2&v3' Smart Development Kit

[![GitHub actions](https://github.com/TheNorthMemory/wechatpay-axios-plugin/workflows/npm%20test/badge.svg)](https://github.com/TheNorthMemory/wechatpay-axios-plugin/actions)
[![GitHub release](https://img.shields.io/npm/v/wechatpay-axios-plugin)](https://github.com/TheNorthMemory/wechatpay-axios-plugin/releases)
[![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/wechatpay-axios-plugin?label=snyk.io)](https://snyk.io/advisor/npm-package/wechatpay-axios-plugin)
[![Vulnerabilities](https://snyk.io/advisor/npm-package/tmc.js/badge.svg)](https://snyk.io/advisor/npm-package/wechatpay-axios-plugin)
[![types](https://img.shields.io/badge/types-included-blue)](https://www.npmjs.com/package/wechatpay-axios-plugin)
[![Node](https://img.shields.io/node/v/wechatpay-axios-plugin)](https://www.npmjs.com/package/wechatpay-axios-plugin)
[![NPM downloads per month](https://img.shields.io/npm/dm/wechatpay-axios-plugin)](https://www.npmjs.com/package/wechatpay-axios-plugin)
[![NPM license](https://img.shields.io/npm/l/wechatpay-axios-plugin?color=blue)](https://www.npmjs.com/package/wechatpay-axios-plugin)
[![NPM license](https://img.shields.io/npm/l/wechatpay-axios-plugin)](https://www.npmjs.com/package/wechatpay-axios-plugin)

## 主要功能

Expand Down
37 changes: 17 additions & 20 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="node" />
import { ReadStream } from "fs";
import { Readable } from "stream";
import { AgentOptions } from "https";
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
import { CipherKey, BinaryLike } from 'crypto'

Expand Down Expand Up @@ -406,39 +407,35 @@ export namespace WechatpayAxiosPlugin {
}

/**
* @typedef {Object} apiConfig - The wechatpay consumer side configuration
* @prop {string} mchid - The merchant ID
* @prop {string} serial - The serial number of the merchant certificate
* @prop {string|Buffer} privateKey - The merchant private key certificate
* @prop {platformCertificates} certs - The wechatpay provider size configuration, `{serial: publicKey}` pair
* This SDK mandatory configuration
*/
type apiConfig = {
/** The merchant ID */
mchid: string,
/** The serial number of the merchant certificate, only for APIv3 */
serial: string,
/** The merchant private key certificat, only for APIv3e */
privateKey: string | Buffer,
/** The wechatpay platform certificates in {serial: publicKey} format, only for APIv3 */
certs: platformCertificates,
/** The merchant secret key string, only for APIv2 */
secret?: string,
merchant?: merchantCertificate
/** The merchant private key and certificate configuration for APIv2, while there were required in secure communication. */
merchant?: merchantCertificate & AgentOptions
}

/**
* @typedef {Object} merchantCertificate - The merchant certification for APIv2
* @prop {string|Buffer} key - The merchant private key certificate as PEM format
* @prop {string|Buffer} cert - The merchant certificate as PEM format
* @prop {string|Buffer} pfx - The merchant private key and certificates as PKCS12 format
* @prop {string} passphase - The merchant PKCS12 certificates' passphase
*/
/** @deprecated - use {@link AgentOptions} directly */
type merchantCertificate = {
/** The merchant private key certificate as PEM format */
key?: string | Buffer,
/** The merchant certificate as PEM format */
cert?: string | Buffer,
/** The merchant private key and certificate buffer in PKCS12 format */
pfx?: Buffer,
passphase?: string
/** The merchant private key and certificate's passphrase */
passphrase?: string
}

/**
* @typedef {Object} platformCertificates - The wechatpay provider side configuration
* @prop {string} key - The serial number of the wechatpay certificate
*/
type platformCertificates = {
[key: string]: string | Buffer
}
Expand Down Expand Up @@ -732,7 +729,7 @@ export namespace WechatpayAxiosPlugin {
* @param {object} config - configuration
* @param {string} [config.mchid] - The merchant ID
* @param {string} [config.secret] - The merchant secret key string
* @param {object} [config.merchant] - The merchant certificates, more @see {import('tls').createSecureContext}
* @param {object} [config.merchant] - The merchant private key and certificate AKA {@link AgentOptions} for APIv2, while there were required in secure communication.
* @param {string|Buffer} [config.merchant.cert] - The merchant cert chains in PEM format
* @param {string|Buffer} [config.merchant.key] - The merchant private keys in PEM format
* @param {string|Buffer} [config.merchant.pfx] - The merchant PFX or PKCS12 encoded private key and certificate chain.
Expand Down Expand Up @@ -782,7 +779,7 @@ export namespace WechatpayAxiosPlugin {
* @param {string|Buffer} config.privateKey - The merchant private key certificate
* @param {object} config.certs - The wechatpay provider size configuration, `{serial: publicKey}` pair
* @param {string} [config.secret] - The merchant secret key string
* @param {object} [config.merchant] - The merchant certificates, more @see {import('tls').createSecureContext}
* @param {object} [config.merchant] - The merchant private key and certificate AKA {@link AgentOptions} for APIv2, while there were required in secure communication.
* @param {string|Buffer} [config.merchant.cert] - The merchant cert chains in PEM format
* @param {string|Buffer} [config.merchant.key] - The merchant private keys in PEM format
* @param {string|Buffer} [config.merchant.pfx] - The merchant PFX or PKCS12 encoded private key and certificate chain.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechatpay-axios-plugin",
"version": "0.8.7",
"version": "0.8.8",
"description": "微信支付APIv2及v3 NodeJS SDK,支持CLI模式请求OpenAPI,支持v3证书下载,v2付款码支付、企业付款、退款,企业微信-企业支付-企业红包/向员工付款,v2&v3 Native支付、扫码支付、H5支付、JSAPI/小程序支付、合单支付...",
"main": "index.js",
"typings": "index.d.ts",
Expand Down Expand Up @@ -51,8 +51,8 @@
"author": "James ZHANG",
"license": "MIT",
"dependencies": {
"axios": "^0.21.2",
"xml2js": "^0.5.0"
"axios": "0.21.2 - 0.27",
"xml2js": "0.5 - 0.6"
},
"peerDependencies": {
"yargs": "^17.1.1"
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/transformer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ describe('lib/transformer', () => {
});

it('method `toObject` should returns `{mch_id: \'10000100\'}` while a `<xml><mch_id>10000100</mch_id></xml>` string passed in', () => {
/* eslint-disable-next-line camelcase */
should(Transformer.toObject('<xml><mch_id>10000100</mch_id></xml>')).be.eql(Object.assign(Object.create(null), { mch_id: '10000100' }));
should(Transformer.toObject('<xml><mch_id>10000100</mch_id></xml>')).be.Object().and.have.property('mch_id', '10000100');
should(Object.keys(Transformer.toObject('<xml><mch_id>10000100</mch_id></xml>'))).be.length(1);
/* eslint-disable-next-line camelcase */
should(JSON.stringify(Transformer.toObject('<xml><mch_id>10000100</mch_id></xml>'))).be.eql(JSON.stringify({ mch_id: '10000100' }));
});
Expand Down

0 comments on commit 75fd266

Please sign in to comment.