feat(M08-B): 接入保洁微信转账适配器

This commit is contained in:
Codex
2026-06-27 16:07:41 +08:00
parent 05907a6bea
commit b07c451700
22 changed files with 663 additions and 27 deletions
+22 -1
View File
@@ -29,7 +29,13 @@ const responses = [
{ prepay_id: 'wx-prepay-test' },
{ trade_state: 'SUCCESS', transaction_id: 'wx-transaction-test' },
{ refund_id: 'wx-refund-test', status: 'PROCESSING' },
{ download_url: 'https://api.mch.weixin.qq.com/v3/billdownload/file?token=sanitized' }
{ download_url: 'https://api.mch.weixin.qq.com/v3/billdownload/file?token=sanitized' },
{
out_bill_no: 'CLP501',
transfer_bill_no: 'wx-transfer-501',
state: 'WAIT_USER_CONFIRM',
package_info: 'package-info'
}
];
const transport = {
async request(input) {
@@ -73,6 +79,21 @@ assert.match((await client.downloadTradeBill(
credential, '2026-06-21', 'ALL'
)).download_url, /^https:/);
const transfer = await client.createMerchantTransfer(credential, {
outBillNo: 'CLP501',
openid: 'openid-sanitized',
amountCents: 800,
remark: '保洁结算501',
sceneId: '1000',
reportInfos: [{ infoType: '岗位类型', infoContent: '保洁员' }]
});
assert.equal(transfer.state, 'WAIT_USER_CONFIRM');
assert.equal(transfer.packageInfo, 'package-info');
assert.match(requests[4].url, /\/v3\/fund-app\/mch-transfer\/transfer-bills$/);
assert.match(requests[4].body, /"out_bill_no":"CLP501"/);
assert.match(requests[4].body, /"transfer_amount":800/);
assert.equal(requests[4].headers.Authorization.includes(merchantKeys.privateKey), false);
const notification = encryptedNotification({
out_trade_no: 'PAY-M05B-001',
transaction_id: 'wx-transaction-test',