Metadata-Version: 2.4
Name: bank-statement-spec
Version: 1.3.0
Summary: Zero-dependency validator for QuickBooks .QBO/OFX, SWIFT MT940 (.sta), German DATEV EXTF, Xero CSV, French FEC, and Japanese Yayoi bank statement exports with exact Decimal balance verification.
Author-email: Leren Huan <support@stmtverify.com>
License-Expression: MIT
Project-URL: Homepage, https://stmtverify.com/
Project-URL: Documentation, https://stmtverify.com/tools/accounting-file-validator
Project-URL: Repository, https://github.com/lerenhuan-hash/bank-statement-format-spec
Project-URL: QuickBooks Error Decoder, https://stmtverify.com/tools/qbo-error-code-decoder
Project-URL: Issue Tracker, https://github.com/lerenhuan-hash/bank-statement-format-spec/issues
Keywords: bank-statement,quickbooks,qbo,ofx,mt940,swift,datev,xero,yayoi,fec,accounting,reconciliation,fintech,fitid,ol-221
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Accounting
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Global Bank Statement Accounting Format Reference & CLI Validator

A clean, zero-dependency Python CLI validator and field-level technical specification covering the **trickiest global accounting software import formats** across 12 tax regions — plus cross-border wallet reconciliation specs (Wise, PayPal, Revolut, Payoneer, Airwallex):

- **QuickBooks Web Connect (`.qbo`) & Standard `.ofx`** (US / Canada / Australia MYOB & Xero)
- **SWIFT MT940 (`.sta` / `.mt940`)** (Switzerland Bexio / Abacus, Netherlands Exact Online / Moneybird, Belgium, EU)
- **German DATEV EXTF (`.csv`)** (SKR03, German comma decimals, `S`/`H` Soll/Haben flags)
- **Xero Bank Statement CSV (`.csv`)** (`*Date` ISO `YYYY-MM-DD` / regional, `*Amount`, CWE-1236 formula-injection check)
- **French Pennylane / FEC Semicolon CSV (`.csv`)** (UTF-8 BOM, `;` delimiter, comma decimals)
- **Japanese Yayoi (弥生会計) / freee CSV (`.csv`)** (half-width ASCII numerals, `YYYY/MM/DD`)

> **Want to validate, repair, or convert accounting files instantly without installing Python?**
> Use our **5 100% Free Browser-Only Zero-Upload Tools** (run entirely in local JavaScript — zero server upload, zero signup, also embeddable via 1-line `<iframe>` on [`/partners`](https://stmtverify.com/partners)) plus our free minimal-OAuth Google Sheets Add-On:
> - **[QuickBooks Error Code & Bank Charge Decoder](https://stmtverify.com/tools/qbo-error-code-decoder)** — Instant offline lookup for **40 QuickBooks error codes** (`OL-205`–`OLS-0001`, `Error 101`–`9999`, duplicate `<FITID>`) & cryptic bank/Intuit charge descriptors (paste entire error banners)
> - **[Accounting File Validator](https://stmtverify.com/tools/accounting-file-validator)** — Check `.qbo`, `.ofx`, `MT940`, `DATEV`, `Xero`, `FEC` & `Yayoi` errors locally
> - **[CSV to QuickBooks `.QBO` / `.OFX` Converter](https://stmtverify.com/tools/csv-to-qbo-converter)** — Convert any bank CSV (single Amount or Debit/Credit) with guaranteed unique `<FITID>`s
> - **[`.QBO` / `.OFX` Duplicate `<FITID>` Fixer](https://stmtverify.com/tools/qbo-fitid-fixer)** — Auto-repair colliding `<FITID>` tags & inject `<INTU.BID>` so QuickBooks stops skipping rows
> - **[SWIFT MT940 (`.sta`) Viewer & Excel CSV](https://stmtverify.com/tools/mt940-to-excel)** — Parse European `.sta`/`.mt940` files, prove exact cent balance & export Excel CSV
>
> **Starting from raw bank, credit card, Wise, PayPal, or Revolut PDFs / scans / photos — or batch travel receipts?**
> - **[StmtVerify (stmtverify.com)](https://stmtverify.com/)** — Zero-retention volatile-RAM bank & wallet PDF reconciler (`Opening + Credits − Debits = Closing` exact cent proof).
> - **[ReceiptVerified (stmtverify.com/receipts/)](https://stmtverify.com/receipts/)** — Zero-retention volatile-RAM batch receipt & invoice photo scanner (`Subtotal + Tax + Tip = Total` verified Excel + 4-Up A4 printable attachment PDF).

---

## Why Bank Statement Imports Fail in Accounting Software (Quick Reference)

| Region & Software | Target Format | #1 Import Failure Pitfall | Required Rule |
| :--- | :--- | :--- | :--- |
| **US — QuickBooks Online / Desktop** | `.qbo` (Web Connect) | Duplicate `<FITID>` causes silently skipped rows | Unique `<FITID>` per transaction; exact `<BALAMT>` & `<TRNAMT>` decimal precision |
| **Canada / AU / NZ — Wave, Sage 50, MYOB** | `.ofx` | Date column ambiguity (`MM/DD` vs `DD/MM`) | ISO-style `YYYYMMDD` `<DTPOSTED>` timestamps inside `<STMTTRN>` |
| **UK / NZ / SG / HK — Xero & FreeAgent** | Xero `.csv` | Missing asterisk headers or US/UK date swaps | Exact `*Date` (unambiguous ISO `YYYY-MM-DD`, also accepts `DD/MM/YYYY`), `*Amount` (signed decimal), `Payee`, `Description` |
| **Germany / Austria — DATEV & Lexoffice** | `DATEV EXTF .csv` | Period decimals broken in German Excel/DATEV | Semicolon `;` delimiter, comma decimals (`4820,50`), explicit `S`/`H` column, SKR03 accounts |
| **Switzerland — Bexio, Abacus & Crésus** | `SWIFT MT940 (.sta)` | Apostrophe thousands (`CHF 12'450.50`) parsed as text | Strip apostrophes into comma-decimal MT940 `:60F:` / `:61:` / `:62F:` cent-exact balance proof |
| **Netherlands / Belgium — Exact & Moneybird** | `SWIFT MT940 (.sta)` | `Af` / `Bij` unsigned columns inverted | Strict `D` (Debit / Af) vs `C` (Credit / Bij) indicators with `:60F:` → `:62F:` cent proof |
| **France — Pennylane, Indy & FEC** | Semicolon `.csv` | Broken accents & decimal commas in Excel FR | UTF-8 BOM encoding, `;` separator, `JJ/MM/AAAA`, comma decimal amounts |
| **Japan — 弥生会計 (Yayoi) & freee** | Accounting `.csv` | Full-width numerals (`１２，４５０`) & Wareki dates | Normalized half-width ASCII integers (`¥`), `YYYY/MM/DD`, UTF-8 BOM safe |
| **Cross-Border Wallets (Wise, PayPal, Revolut)** | 4-Col Gross / Fee / Net | Net-only import hides deductible processing fees | Split PayPal `Gross + Fee = Net` into separate revenue + fee ledger rows so running balance reconciles to `0.00` |

---

## Zero-Dependency CLI Validator (`validate_statement_export.py`)

Requires **Python 3.9+** (standard library only — `pip install` not needed).

### Usage

```bash
# Auto-detect format (.sta/.mt940, .qbo/.ofx, DATEV EXTF, Xero, French FEC, or Yayoi CSV)
python validate_statement_export.py path/to/export.sta

# Explicitly specify format
python validate_statement_export.py --format mt940 examples/sample_swiss_mt940.sta
python validate_statement_export.py --format ofx examples/sample_us_quickbooks.qbo
python validate_statement_export.py --format datev examples/sample_de_datev_extf.csv
python validate_statement_export.py --format xero examples/sample_uk_xero.csv
python validate_statement_export.py --format fec examples/sample_fr_fec.csv
python validate_statement_export.py --format yayoi examples/sample_jp_yayoi.csv

# Run all 15 unit tests (v1.2.0)
python test_validator.py
```

### What It Checks

1. **MT940 (`.sta` / `.mt940`)**: Required SWIFT tags (`:20:`, `:25:`, `:60F:`, `:62F:`), multi-statement block splitting, and exact `Decimal` cent-reconciliation `Opening (:60F:) + Credits (:61: C) − Debits (:61: D) == Closing (:62F:)`.
2. **OFX / QuickBooks `.qbo`**: `<OFX>`, `<STMTTRN>`, `<TRNAMT>`, `<DTPOSTED>`, `<FITID>`, duplicate `<FITID>` collision detection, unescaped `&` / control chars (`OL-221`/`OL-222`), `<=32`-char `<NAME>` limit, and `<INTU.BID>` checks.
3. **DATEV EXTF (`.csv`)**: `EXTF` metadata header, semicolon `;` column structure, German comma decimals, positive `Umsatz` + strict `S` / `H` markers, `TTMM` `Belegdatum`, and `<=60`-char `Buchungstext`.
4. **Xero Bank CSV (`.csv`)**: Mandatory `*Date` (ISO `YYYY-MM-DD` / regional) and `*Amount` asterisk headers, numeric validation, and CWE-1236 formula-injection detection.
5. **French FEC / Pennylane CSV (`.csv`)**: Semicolon `;` structure and French comma-decimal compliance.
6. **Japanese Yayoi / freee CSV (`.csv`)**: Full-width numeral (`０-９`) rejection, `YYYY/MM/DD` dates, and numeric validation.

---

## Direct Regional PDF & Cross-Border Wallet Guides

### QuickBooks `.QBO` Troubleshooting, Catch-Up & Mortgage Verification Guides
- **[QuickBooks `.QBO` Import Errors Explained (`OL-221`, `OL-222`, `OL-301`, Missing `<INTU.BID>`, Duplicate `<FITID>`)](docs/quickbooks-qbo-import-errors.md)**
- **[How to Import More Than 90 Days of Bank Statements into QuickBooks Online (12-Month PDF Catch-Up)](docs/quickbooks-12-month-pdf-catchup.md)**
- **[Mortgage & Lending Bank Statement Continuity & Tamper Verification Spec (Non-QM 12-Month Cash Flow)](docs/mortgage-bank-statement-tamper-verification.md)**

If you start from raw bank, credit card, or digital wallet PDFs, encrypted statements, or paper scans:

- **Free Browser-Only File Validator (Zero Upload)**: https://stmtverify.com/tools/accounting-file-validator
- **US (Chase, BofA, Wells Fargo, Amex, US Bank, PNC → QuickBooks `.QBO`)**: https://stmtverify.com/
- **Cross-Border Wallets — Wise (TransferWise) PDF to Excel & QBO**: https://stmtverify.com/lp/wise-statement-pdf-to-excel
- **Cross-Border Wallets — PayPal Monthly PDF (Gross/Fee/Net Split)**: https://stmtverify.com/lp/paypal-statement-pdf-to-excel-qbo
- **Cross-Border Wallets — Revolut / Payoneer / Airwallex**: https://stmtverify.com/lp/revolut-statement-pdf-to-excel-xero
- **UK (Barclays, HSBC, Lloyds, Monzo, Tide → Xero CSV)**: https://stmtverify.com/lp/uk-xero-bank-pdf
- **Germany & Austria (Sparkasse, Volksbank, Commerzbank, Erste Bank → DATEV EXTF)**: https://stmtverify.com/lp/sparkasse-pdf-in-datev
- **Switzerland (UBS, PostFinance, Raiffeisen CHF → Bexio MT940 `.sta`)**: https://stmtverify.com/lp/swiss-bexio-mt940-pdf
- **Netherlands & Belgium (ING, Rabobank, ABN AMRO, KBC → Exact Online MT940)**: https://stmtverify.com/lp/nl-mt940-exact-bank-pdf
- **France (Crédit Agricole, BNP, BoursoBank, Shine → Pennylane / FEC)**: https://stmtverify.com/lp/credit-agricole-pdf-excel
- **Japan (三菱UFJ, 三井住友, 楽天銀行・カード → 弥生会計 / freee CSV)**: https://stmtverify.com/lp/yayoi-bank-pdf-csv
- **Singapore & Hong Kong (HSBC HK, DBS, OCBC → Audit Excel & Xero)**: https://stmtverify.com/lp/sg-hk-audit-bank-pdf
- **Full 96-Bank & Wallet Directory**: https://stmtverify.com/directory

## License

MIT License — free for personal, bookkeeping firm, and commercial integration use.
