feat(telegram): bot bonuri fiscale — OCR → preview → Oracle write

- US-001: mută queue_client.py în data_entry/services/ocr/
- US-002/003/004: oracle_receipt_writer + oracle_server_id în DB
- US-005: receipt_handlers.py (PDF/photo/callback flow)
- US-006: wire handlers în main.py, per-schema connect, seq_cod.nextval
- US-007: .gitignore secrets/*.oracle_pass
- US-008/009/010: teste unit + integration + E2E
- setup-secrets.sh helper + template
- docs/telegram/README.md actualizat cu arhitectura nouă

Testat E2E pe DB live (MARIUSM_AUTO). COD din seq_cod.nextval.
pypdfium2 fallback pentru PDF decode (fără poppler).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 09:26:58 +00:00
parent 8234103884
commit e257fa5d5f
35 changed files with 4531 additions and 227 deletions

View File

@@ -122,7 +122,8 @@ async def link_telegram_account(
oracle_username=oracle_username,
jwt_token=jwt_token,
jwt_refresh_token=jwt_refresh_token,
token_expires_at=token_expires_at
token_expires_at=token_expires_at,
server_id=server_id
)
if not linked:
@@ -235,7 +236,8 @@ async def get_user_auth_data(telegram_user_id: int) -> Optional[Dict[str, Any]]:
"username": oracle_username,
"jwt_token": jwt_token,
"jwt_refresh_token": jwt_refresh_token,
"companies": companies
"companies": companies,
"server_id": user_data.get('oracle_server_id')
}
except Exception as e:
@@ -325,6 +327,7 @@ async def unlink_user(telegram_user_id: int) -> bool:
await db.execute("""
UPDATE telegram_users
SET oracle_username = NULL,
oracle_server_id = NULL,
jwt_token = NULL,
jwt_refresh_token = NULL,
token_expires_at = NULL,