qbo_auth: realmId шифруется, /callback отвечает 302, no-cache; требования Intuit: раздел E по оригиналу, ручные тесты через /tests
All checks were successful
ci / test (push) Successful in 38s
ci / deploy (push) Successful in 2m38s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 09:21:39 +03:00
parent b0a68930b1
commit e90b9f352d
7 changed files with 65 additions and 34 deletions

View File

@@ -36,8 +36,9 @@ const notify = async (text: string): Promise<void> => {
/** Компания QuickBooks берётся из подключения qbo_auth. */
async function realmId(): Promise<string> {
const { rows } = await pool.query("select realm_id from qbo_connection order by refreshed_at desc limit 1");
if (!rows[0]) throw new Error("QuickBooks не подключён (нет строки в qbo_connection)");
// realm_id в qbo_connection зашифрован (требование Intuit); компания берётся из последней успешной загрузки зеркала
const { rows } = await pool.query("select realm_id from qbo_sync_run where status = 'ok' and realm_id is not null order by started_at desc limit 1");
if (!rows[0]) throw new Error("QuickBooks не подключён или зеркало ещё не загружено (нет успешной загрузки в qbo_sync_run)");
return rows[0].realm_id as string;
}