node-easywechat 3.5.2 → 3.5.5
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/CHANGELOG.md +10 -0
- package/dist/Core/Contracts/ServerInterface.d.ts +2 -1
- package/dist/Core/Contracts/ServerInterface.js +2 -1
- package/dist/Core/Support/PrivateKey.js +3 -0
- package/dist/Core/Support/PublicKey.js +3 -0
- package/dist/MiniApp/Application.js +3 -0
- package/dist/OfficialAccount/Application.js +3 -0
- package/dist/OpenPlatform/Application.js +3 -0
- package/dist/OpenWork/Application.js +3 -0
- package/dist/Pay/Application.js +3 -0
- package/dist/Pay/Signature.js +2 -2
- package/dist/Pay/Utils.d.ts +3 -3
- package/dist/Pay/Utils.js +2 -2
- package/dist/Types/global.d.ts +3 -3
- package/dist/Work/Application.js +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,7 @@ import ResponseInterface from "../Http/Contracts/ResponseInterface";
|
|
|
2
2
|
import DecryptXmlMessageMixin from "../Mixins/DecryptXmlMessageMixin";
|
|
3
3
|
import HandlersMixin from "../Mixins/HandlersMixin";
|
|
4
4
|
import ResponseXmlMessageMixin from "../Mixins/ResponseXmlMessageMixin";
|
|
5
|
+
import ServerRequestMixin from "../Mixins/ServerRequestMixin";
|
|
5
6
|
declare abstract class ServerInterface {
|
|
6
7
|
constructor();
|
|
7
8
|
/**
|
|
@@ -9,6 +10,6 @@ declare abstract class ServerInterface {
|
|
|
9
10
|
*/
|
|
10
11
|
serve(): Promise<ResponseInterface>;
|
|
11
12
|
}
|
|
12
|
-
interface ServerInterface extends HandlersMixin, DecryptXmlMessageMixin, ResponseXmlMessageMixin {
|
|
13
|
+
interface ServerInterface extends HandlersMixin, DecryptXmlMessageMixin, ResponseXmlMessageMixin, ServerRequestMixin {
|
|
13
14
|
}
|
|
14
15
|
export = ServerInterface;
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
const DecryptXmlMessageMixin_1 = __importDefault(require("../Mixins/DecryptXmlMessageMixin"));
|
|
15
15
|
const HandlersMixin_1 = __importDefault(require("../Mixins/HandlersMixin"));
|
|
16
16
|
const ResponseXmlMessageMixin_1 = __importDefault(require("../Mixins/ResponseXmlMessageMixin"));
|
|
17
|
+
const ServerRequestMixin_1 = __importDefault(require("../Mixins/ServerRequestMixin"));
|
|
17
18
|
const Utils_1 = require("../Support/Utils");
|
|
18
19
|
class ServerInterface {
|
|
19
20
|
constructor() {
|
|
@@ -28,5 +29,5 @@ class ServerInterface {
|
|
|
28
29
|
}
|
|
29
30
|
;
|
|
30
31
|
;
|
|
31
|
-
(0, Utils_1.applyMixins)(ServerInterface, [HandlersMixin_1.default, DecryptXmlMessageMixin_1.default, ResponseXmlMessageMixin_1.default]);
|
|
32
|
+
(0, Utils_1.applyMixins)(ServerInterface, [HandlersMixin_1.default, DecryptXmlMessageMixin_1.default, ResponseXmlMessageMixin_1.default, ServerRequestMixin_1.default]);
|
|
32
33
|
module.exports = ServerInterface;
|
|
@@ -77,6 +77,9 @@ class Application {
|
|
|
77
77
|
if (!this.server) {
|
|
78
78
|
this.server = new Server_1.default(this.getRequest(), this.getAccount().getAesKey() ? this.getEncryptor() : null);
|
|
79
79
|
}
|
|
80
|
+
else {
|
|
81
|
+
this.server.setRequest(this.getRequest());
|
|
82
|
+
}
|
|
80
83
|
return this.server;
|
|
81
84
|
}
|
|
82
85
|
/**
|
|
@@ -98,6 +98,9 @@ class Application {
|
|
|
98
98
|
if (!this.server) {
|
|
99
99
|
this.server = new Server_1.default(this.getAccount().getAesKey() ? this.getEncryptor() : null, this.getRequest());
|
|
100
100
|
}
|
|
101
|
+
else {
|
|
102
|
+
this.server.setRequest(this.getRequest());
|
|
103
|
+
}
|
|
101
104
|
return this.server;
|
|
102
105
|
}
|
|
103
106
|
/**
|
package/dist/Pay/Application.js
CHANGED
package/dist/Pay/Signature.js
CHANGED
|
@@ -36,8 +36,8 @@ class Signature {
|
|
|
36
36
|
}
|
|
37
37
|
let signString = `${method.toUpperCase()}\n${pathname}\n${timestamp}\n${nonce}\n${body}\n`;
|
|
38
38
|
let rsa = new RSA_1.default;
|
|
39
|
-
rsa.setPublicKey(this.merchant.getCertificate().
|
|
40
|
-
rsa.setPrivateKey(this.merchant.getPrivateKey().
|
|
39
|
+
rsa.setPublicKey(this.merchant.getCertificate().toString());
|
|
40
|
+
rsa.setPrivateKey(this.merchant.getPrivateKey().toString());
|
|
41
41
|
let sign = rsa.sign(signString);
|
|
42
42
|
return `WECHATPAY2-SHA256-RSA2048 mchid="${this.merchant.getMerchantId()}",nonce_str="${nonce}",timestamp="${timestamp}",serial_no="${this.merchant.getCertificate().getSerialNo()}",signature="${sign}"`;
|
|
43
43
|
}
|
package/dist/Pay/Utils.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare class Utils {
|
|
|
24
24
|
* @param signType v3仅支持RSA,V2支持MD5、HMAC-SHA256
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
|
-
buildBridgeConfig(prepayId: string, appId: string, signType?:
|
|
27
|
+
buildBridgeConfig(prepayId: string, appId: string, signType?: 'RSA' | 'MD5' | 'HMAC-SHA256'): PayBridgeConfig;
|
|
28
28
|
/**
|
|
29
29
|
* 构建JS-SDK支付参数
|
|
30
30
|
* @see https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#58
|
|
@@ -32,7 +32,7 @@ declare class Utils {
|
|
|
32
32
|
* @param appId 应用id
|
|
33
33
|
* @param signType v3仅支持RSA,V2支持MD5、HMAC-SHA256
|
|
34
34
|
*/
|
|
35
|
-
buildSdkConfig(prepayId: string, appId: string, signType?:
|
|
35
|
+
buildSdkConfig(prepayId: string, appId: string, signType?: 'RSA' | 'MD5' | 'HMAC-SHA256'): PaySdkConfig;
|
|
36
36
|
/**
|
|
37
37
|
* 构建小程序支付参数
|
|
38
38
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html
|
|
@@ -41,7 +41,7 @@ declare class Utils {
|
|
|
41
41
|
* @param signType v3仅支持RSA,V2支持MD5、HMAC-SHA256
|
|
42
42
|
* @returns
|
|
43
43
|
*/
|
|
44
|
-
buildMiniAppConfig(prepayId: string, appId: string, signType?:
|
|
44
|
+
buildMiniAppConfig(prepayId: string, appId: string, signType?: 'RSA' | 'MD5' | 'HMAC-SHA256'): PayBridgeConfig;
|
|
45
45
|
/**
|
|
46
46
|
* 构建App支付参数
|
|
47
47
|
* @see https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_2_4.shtml
|
package/dist/Pay/Utils.js
CHANGED
|
@@ -70,7 +70,7 @@ class Utils {
|
|
|
70
70
|
buildBridgeConfig(prepayId, appId, signType = 'RSA') {
|
|
71
71
|
let params = {
|
|
72
72
|
appId,
|
|
73
|
-
timeStamp: (0, Utils_1.getTimestamp)(),
|
|
73
|
+
timeStamp: '' + (0, Utils_1.getTimestamp)(),
|
|
74
74
|
nonceStr: (0, Utils_1.randomString)(),
|
|
75
75
|
package: 'prepay_id=' + prepayId,
|
|
76
76
|
signType,
|
|
@@ -129,7 +129,7 @@ class Utils {
|
|
|
129
129
|
partnerid: this.merchant.getMerchantId(),
|
|
130
130
|
prepayid: prepayId,
|
|
131
131
|
nonceStr: (0, Utils_1.randomString)(),
|
|
132
|
-
timestamp: (0, Utils_1.getTimestamp)(),
|
|
132
|
+
timestamp: '' + (0, Utils_1.getTimestamp)(),
|
|
133
133
|
package: 'Sign=WXPay',
|
|
134
134
|
sign: '',
|
|
135
135
|
};
|
package/dist/Types/global.d.ts
CHANGED
|
@@ -398,7 +398,7 @@ export interface PayBridgeConfig {
|
|
|
398
398
|
/**
|
|
399
399
|
* 时间戳
|
|
400
400
|
*/
|
|
401
|
-
timeStamp:
|
|
401
|
+
timeStamp: string;
|
|
402
402
|
/**
|
|
403
403
|
* 随机字符串
|
|
404
404
|
*/
|
|
@@ -428,7 +428,7 @@ export interface PaySdkConfig {
|
|
|
428
428
|
/**
|
|
429
429
|
* 时间戳
|
|
430
430
|
*/
|
|
431
|
-
timestamp:
|
|
431
|
+
timestamp: string;
|
|
432
432
|
/**
|
|
433
433
|
* 随机字符串
|
|
434
434
|
*/
|
|
@@ -474,7 +474,7 @@ export interface PayAppConfig {
|
|
|
474
474
|
/**
|
|
475
475
|
* 时间戳
|
|
476
476
|
*/
|
|
477
|
-
timestamp:
|
|
477
|
+
timestamp: string;
|
|
478
478
|
/**
|
|
479
479
|
* 签名
|
|
480
480
|
*/
|
package/dist/Work/Application.js
CHANGED