**Not mergeable as written, but close:** four things need fixing before merge, and each is small enough to do before tomorrow. The structure itself is good (thin `run()`, parameterised SQL, one job per function). I only read `export_job.py`; I did not run it or open `test_export_job.py`, so the test comments rely on the docstring.

## Must fix before merge

1. **Failures are silent (lines 56-57).** `run()` catches every exception, logs one line and exits with code 0, so cron and any monitoring see success. For example, if the finance endpoint returns a 500, no file arrives and nothing alerts. Re-raise after logging (or `sys.exit(1)`) and use `log.exception` so the traceback is kept.

2. **A missed day is never exported (line 47).** The date is always "yesterday" and there is no way to pass one in. If the 14 Nov run fails, the 15 Nov run exports only 14 Nov's invoices and 13 Nov's are never sent. Add a `--date` argument. Combined with item 1, days can go missing unnoticed.

3. **Customer emails are written to the log (line 52).** Every run logs the full list of customer email addresses. Log the count only.

4. **The upload has no timeout (line 42).** `requests.post` without `timeout=` waits forever if the endpoint stalls, and the job hangs until someone kills it. Add something like `timeout=(10, 120)`.

## Should fix (can follow shortly after if you're pressed)

5. **Logging is never configured.** There is no `logging.basicConfig`, so when run as a script both `log.info` lines are dropped and errors print as a bare message with no timestamp.

6. **Tests cover only the CSV header and one row.** Nothing tests the date window in `fetch_invoices`, an upload failure, or what `run()` does on error. Items 1 and 2 are the behaviours most worth pinning down.

7. **The "yesterday" window depends on two time zones (lines 28, 47).** `date.today()` uses the server's zone, and the database turns the date into midnight in its session zone. If they differ (say server in UTC, database in IST), invoices paid near midnight land in the wrong day's file. Build explicit timezone-aware start and end timestamps.

8. **Amount formatting (line 37).** `amount_cents / 100` writes 1000 as `10.0` and 1050 as `10.5`, not `10.00` and `10.50`. It is also wrong for currencies without two decimals: a 500 JPY invoice exports as `5.0`. If you only bill in two-decimal currencies, formatting with `Decimal` is enough.

9. **Re-running sends the same file again.** If the upload succeeded but a later step failed, a rerun posts a duplicate. Check whether the finance endpoint de-duplicates by filename; if not, this matters once item 2 adds reruns.

10. **No authentication is visible on the upload (line 42).** If the credential is embedded in `FINANCE_UPLOAD_URL`, that is fine but worth a comment; if not, the endpoint is taking customer data unauthenticated.

## Minor

11. **`UPLOAD_URL` is read at import time (line 16).** Importing the module without the variable set raises `KeyError`, including in tests. Read it inside `upload()` or `run()`.
12. **Exported files stay in `/var/exports` forever.** They contain customer emails, have default permissions and are never cleaned up; the directory is hard-coded and assumed to exist.
13. **A null `amount_cents` aborts the whole export.** One such row raises `TypeError`, which item 1 then hides.
14. **Spreadsheet formula injection.** An email starting with `=`, `+`, `-` or `@` is run as a formula if finance opens the CSV in Excel. Prefix such cells with `'`.
15. **`fetchall()` loads the whole day into memory (line 29).** Fine at current volume; a server-side cursor would be needed at scale.
16. **Empty days upload a header-only file.** Confirm finance wants that rather than no file.
17. **Invoices refunded before 02:00 are dropped.** An invoice paid yesterday and refunded before the run no longer has status `PAID`. Confirm that is intended.
18. **No explicit file encoding (line 33).** Add `encoding="utf-8"` so it does not depend on cron's locale.
19. **The connect call is outside the `try` (line 49).** A connection failure crashes with a traceback while every other failure is swallowed; this resolves itself once item 1 is fixed.
20. **The `amount` header has no unit, and there are no type hints.** Cosmetic.

VERDICT: READY WITH CHANGES
