Files
WYGIWYH/app/apps/bank_sync/tasks.py
T
Herculino Trotta 620e7df015 feat(bank-sync): sync bank transactions from external providers
Provider registry modeled after automatic exchange rates: each provider
declares its own settings fields, rendered dynamically in the service form.
Lunch Flow is the first provider.

- Map provider accounts to WYGIWYH accounts with a start date and an
  optional currency filter
- Hourly task syncs due services; manual sync from the list
- Deduplicates through Transaction.internal_id, optionally matching
  transactions already entered by hand
- Per account errors and provider reported connection problems

Refs #498
2026-11-08 12:39:16 -03:00

18 lines
523 B
Python

from procrastinate.contrib.django import app
from apps.bank_sync.models import BankSyncService
from apps.bank_sync.sync import sync_due_services, sync_service
@app.periodic(cron="0 * * * *")
@app.task(lock="bank_sync", name="automatic_bank_sync")
def automatic_bank_sync(timestamp=None):
sync_due_services()
@app.task(lock="bank_sync", name="manual_bank_sync")
def manual_bank_sync(service_id: int):
service = BankSyncService.objects.filter(id=service_id).first()
if service:
sync_service(service)