Add WeChat in-app JSAPI recharge for g2.tkmind.cn.
Use JSAPI with bound openid inside WeChat instead of QR long-press, and include related auth redirect and admin UX fixes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
buildV2JsapiParams,
|
||||
buildXml,
|
||||
createWechatPayClient,
|
||||
loadWechatPayConfig,
|
||||
@@ -81,6 +82,18 @@ test('loadWechatPayConfig selects v2 when APIv2 key is configured', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('buildV2JsapiParams signs prepay package for WeixinJSBridge', () => {
|
||||
const config = {
|
||||
appId: 'wxtestappid',
|
||||
apiKey: 'test-api-v2-key-32chars-long!!!!',
|
||||
};
|
||||
const params = buildV2JsapiParams(config, 'wx201410272009395522657a690389285100');
|
||||
assert.equal(params.appId, 'wxtestappid');
|
||||
assert.equal(params.package, 'prepay_id=wx201410272009395522657a690389285100');
|
||||
assert.equal(params.signType, 'MD5');
|
||||
assert.match(params.paySign, /^[0-9A-F]{32}$/);
|
||||
});
|
||||
|
||||
test('verifyNotify validates v2 callback signature', () => {
|
||||
const apiKey = 'test-api-v2-key-32chars-long!!!!';
|
||||
const fields = {
|
||||
|
||||
Reference in New Issue
Block a user