实现企业银行账户与建行制单(corporate-bank-account-payment-order)

这个提交包含在:
2026-08-02 23:36:40 +08:00
父节点 f946d64539
当前提交 5261d2849b
共修改 46 个文件,包含 2751 行新增和 73 行删除
+11 -2
查看文件
@@ -2,6 +2,9 @@ const Fastify = require('fastify');
const meRoutes = require('../../../src/routes/me');
const { AppError } = require('../../../src/utils/AppError');
const { encryptStringOrThrow } = require('../../../src/services/crypto');
const FIELD_ENCRYPTION_KEY = Buffer.alloc(32, 7).toString('base64');
function createPrismaState(overrides = {}) {
const auditEntries = [];
@@ -18,6 +21,7 @@ function createPrismaState(overrides = {}) {
emergency_contact_phone: null,
bank_account_encrypted: '',
bank_name: '',
bank_institution: null,
avatar_path: null,
id_number_encrypted: null,
notification_push_enabled: true,
@@ -53,6 +57,7 @@ function createPrismaState(overrides = {}) {
async function buildApp(prisma) {
const app = Fastify();
app.decorate('prisma', prisma);
app.decorate('config', { fieldEncryptionKey: FIELD_ENCRYPTION_KEY });
app.decorate('authenticate', async (request) => {
if (!request.headers.authorization) {
throw new AppError({
@@ -130,8 +135,12 @@ describe('me routes', () => {
const { prisma } = createPrismaState({
emergency_contact_name: '联系人',
emergency_contact_phone: '13900000000',
bank_account_encrypted: 'ENC',
bank_name: '招商银行',
bank_account_encrypted: encryptStringOrThrow(
{ fieldEncryptionKey: FIELD_ENCRYPTION_KEY },
'6222000012345678',
),
bank_name: '中国建设银行',
bank_institution: { id: 'bank-1', code: 'CCB', name: '中国建设银行' },
avatar_path: null,
id_number_encrypted: null,
});