Skip to content

Commit

Permalink
Transformer.toXml usage sample
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNorthMemory committed Sep 18, 2020
1 parent fb2aeee commit 4719bd0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ client.post('https://fraud.mch.weixin.qq.com/risk/getpublickey', {
}).then(({data}) => console.info(data)).catch(({response}) => console.error(response))
```
### 通知应答
```javascript
const {Transformer} = require('wechatpay-axios-plugin')
const xml = Transformer.toXml({
return_code: 'SUCCESS',
return_msg: 'OK',
})

console.info(xml)
```
## aes-256-ecb/pcks7padding
### v0.3.1开始支持解密
Expand Down
2 changes: 1 addition & 1 deletion lib/aes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Aes {
static get base64() { return `base64` }

/**
* @property {string} BLOCK_SIZE - The `aes` block size
* @property {integer} BLOCK_SIZE - The `aes` block size
*/
static get BLOCK_SIZE() { return 16 }

Expand Down
5 changes: 5 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ utils.extend(utils, {
return this.isProcessEnv() && this.isObject(val) && val.toString() === '[object FormData]'
},

/**
* Compose the `User-Agent` content
*
* @returns {string} - The `User-Agent` value
*/
userAgent: function() {
const {name: pkgName, version: pkgVersion} = require('../package.json')
const {version: axiosVersion} = require('axios/package.json')
Expand Down

0 comments on commit 4719bd0

Please sign in to comment.