node-easywechat 3.6.1 → 3.6.3

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.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## 我的环境 / My Environment
11
+
12
+ * Node 版本 / Version:
13
+ * node-easywechat 版本 / Version:
14
+ * 所用框架及版本 / Framework & Version:
15
+
16
+ ## 问题描述 / Description the issue
package/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v3.6.3 (2024-05-08)
5
+
6
+ - Fix: 修复微信支付(v3)时签名错误的问题 (#76)
7
+
8
+ ## v3.6.2 (2024-04-09)
9
+
10
+ - Fix: 调整默认token的缓存名称与easywechat一致
11
+
4
12
  ## v3.6.1 (2024-03-16)
5
13
 
6
14
  ## v3.6.0 (2024-03-16)
@@ -36,7 +36,7 @@ class AccessToken {
36
36
  */
37
37
  getKey() {
38
38
  if (!this.key) {
39
- this.key = `${this.CACHE_KEY_PREFIX}.access_token.${this.appId}`;
39
+ this.key = `${this.CACHE_KEY_PREFIX}.access_token.${this.appId}.${this.secret}.${this.stable ? 1 : 0}`;
40
40
  }
41
41
  return this.key;
42
42
  }
@@ -31,7 +31,7 @@ class ProviderAccessToken {
31
31
  */
32
32
  getKey() {
33
33
  if (!this.key) {
34
- this.key = `open_work.access_token.${this.corpId}`;
34
+ this.key = `open_work.access_token.${this.corpId}.${this.providerSecret}`;
35
35
  }
36
36
  return this.key;
37
37
  }
@@ -32,7 +32,7 @@ class SuiteAccessToken {
32
32
  */
33
33
  getKey() {
34
34
  if (!this.key) {
35
- this.key = `open_work.suite_access_token.${this.suiteId}`;
35
+ this.key = `open_work.suite_access_token.${this.suiteId}.${this.suiteSecret}`;
36
36
  }
37
37
  return this.key;
38
38
  }
@@ -62,10 +62,19 @@ class Client {
62
62
  payload.headers['user-agent'] = (0, Utils_1.createUserAgent)();
63
63
  }
64
64
  if (this.isV3Request(url) && !payload.headers['authorization']) {
65
+ if (typeof payload.json !== 'undefined') {
66
+ if (typeof payload.json === 'object') {
67
+ payload.data = JSON.stringify(payload.json);
68
+ }
69
+ else if (typeof payload.json === 'string') {
70
+ payload.data = payload.json;
71
+ }
72
+ delete payload.json;
73
+ }
65
74
  payload.headers['authorization'] = this.createSignature(method, url, payload);
66
75
  }
67
76
  else {
68
- if (payload.xml) {
77
+ if (typeof payload.xml !== 'undefined') {
69
78
  if (typeof payload.xml === 'object') {
70
79
  payload.xml = (0, Utils_1.buildXml)(this.attachLegacySignature(payload.xml));
71
80
  }
@@ -31,7 +31,7 @@ class AccessToken {
31
31
  */
32
32
  getKey() {
33
33
  if (!this.key) {
34
- this.key = `work.access_token.${this.corpId}`;
34
+ this.key = `work.access_token.${this.corpId}.${this.secret}`;
35
35
  }
36
36
  return this.key;
37
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-easywechat",
3
- "version": "3.6.1",
3
+ "version": "3.6.3",
4
4
  "description": "EasyWechat SDK for Node.js (NOT OFFICIAL)",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {