This project provides custom ofxstatement plugin(s) for these french financial institutions:
- BanquePopulaire, France, PDF (https://www.banquepopulaire.fr/)
ofxstatement
is a tool to convert a proprietary bank statement to OFX
format, suitable for importing into programs like GnuCash or Beancount. The
plugin for ofxstatement parses the bank statement and produces a common data
structure, that is then formatted into an OFX file.
The PDF is converted using the pdftotext utility.
This bank allows you to download OFX files but only for transactions not older than 90 days. In order to read the transactions older than 90 days, you need to download a PDF from their site: Mon espace -> Mes documents électroniques -> Comptes / Epargne et placements. This utility can convert such a PDF to an OFX file.
Having a PDF is also useful for a visual verification but it is only generated every month, so you may need to download the OFX file now and then too for the actual status. There rests one problem: the OFX file generated by BanquePopulaire contains FITIDs not equal to the default FITID generated by this utility. So my solution is to download the OFX from BanquePopulaire regularly and the PDF every month. In the Configuration setup you can specify wildcards for the location of OFX files so that this utility will use the FITID from the (downloaded) OFX instead of its own default and hence any financial program will see the same transaction whether it is from the downloaded OFX or from the OFX created from the PDF. The OFX and PDF may also differ in some details like DATE, PAYEE and MEMO fields and this will be handled too by processing downloaded OFX files for their FITID.
You have to install the poppler library first, see pdftotext
$ pip install ofxstatement-french
$ git clone https://github.com/gpaulissen/ofxstatement-french.git
$ pip install -e .
This package depends on ofxstatement with a version at least 0.6.5. This version may not yet be available in PyPI so install that from source like this:
$ git clone https://github.com/gpaulissen/ofxstatement.git
$ pip install -e .
To run the tests from the development version you can use the py.test command:
$ py.test
You may need to install the required test packages first:
$ pip install -r test_requirements.txt
This shows the all installed plugins, not only those from this package:
$ ofxstatement list-plugins
You should see at least:
The following plugins are available:
...
fr-banquepopulaire BanquePopulaire, France, PDF (https://www.banquepopulaire.fr/)
...
Use something like this:
$ ofxstatement convert -t fr-banquepopulaire <file>.pdf <file>.ofx
Or you can convert the PDF yourself and supply the text as input:
$ pdftotext -layout <file>.pdf <file>.txt
$ ofxstatement convert -t fr-banquepopulaire <file>.txt <file>.ofx
See also the section configuration below.
For BanquePopulaire you may download their OFX files and use them to provide you with their OFX FITID numbers instead of relying on FITID numbers generated by the ofxstatement tool. You can specifiy the OFX files to read first using the ofxstatement configuration. The OFX files configuration is a comma separated list of wildcard specifications relative to the PDF to convert.
You may also need to set a bank id, since the statement files do not always contain bank information like the BIC code in this line:
IBAN FR99 9999 9999 9999 9999 9999 999 BIC CCBPFRPPBDX *** C A S D E N-B P ***
$ ofxstatement edit-config
This is a sample configuration (do not forget to specify the plugin for each section):
[banquepopulaire]
plugin = fr-banquepopulaire
ofx_files = *.ofx, ../*.ofx
bank_id = CCBPFRPPBDX
Now this statement will convert .pdf downloaded from BanquePopulaire (Mon Espace -> Mes documents électroniques -> Comptes) to .ofx while using the FITIDs found in the *.ofx files in the directory of .pdf or in its parent directory.
$ ofxstatement convert -t banquepopulaire <file>.pdf <file>.ofx
See the Changelog (CHANGELOG.md).