The Postfinance import goes through the follwoing steps:
- If no
PF_SFTP_CONNECTIONS
are configured,GOTO 4
. - Download all
camt053.xml
andcamt053.tar.gz
files from all configured Sftp servers. - Write these files to the following db table:
postfinanceImports
. - Read all files where
isImported === false
from the db. - Unpack all
tar
files. These contain onecamt053.xml
file and.tiff
files. The images are scans of over the counter cash payments (Einzahlungsschein). - Convert images to
.jpeg
. - Parse XML files (c.f. parseCamt053.u.jest.ts).
- Filter out the following payment entries:
- All
DEBIT
entries. - All
CREDIT
entries fromSTRIPE
. - All
CREDIT
entries fromPAYPAL
. - All debit card
CREDIT
entries (Online Postfinance Zahlung).
- Write payment entries to the follwing db table:
postfinancePayments
. - Run the payment matcher.
- Send notifications to accountant.
- If all payments could be matched, send payment reminders.
As you can see in the .env.example
file, the Sftp servers are configured as follows:
PF_SFTP_CONNECTIONS=[{ host: 'one.com', port: 2222, username: 'accountant', privateKey: '-----BEGIN OPENSSH PRIVATE KEY-----\n...\n\n-----END OPENSSH PRIVATE KEY-----\n'},{ host: 'two.com', port: 2222, username: 'accountant', privateKey: '-----BEGIN OPENSSH PRIVATE KEY-----\n...\n\n-----END OPENSSH PRIVATE KEY-----\n'}]
Dry run sending payment reminders by setting the following .env
:
DRY_RUN_SEND_PAYMENT_REMINDERS=true
On development, you can run the postfinance import task as follows:
cd packages/republik-crowdfundings && yarn dev:postfinance:import
If you prefere to work without a local Sftp server, you can get
the entries from the following db table from production: postfinanceImports
.
If contains the files from the Sftp server. All files that isImported === FALSE
will be imported.
camt.053 (account statement) is part of ISO 20022 XML format and files Postfinance provides.