Python SEPA XML implementations
Project description
This is a python implementation to generate SEPA XML files.
Limitations
Supported standards:
SEPA PAIN.001.001.03
SEPA PAIN.001.003.03
SEPA PAIN.008.001.02
SEPA PAIN.008.002.02
SEPA PAIN.008.003.02
Usage
Direct debit
Example:
from sepaxml import SepaDD
import datetime, uuid
config = {
"name": "Test von Testenstein",
"IBAN": "NL50BANK1234567890",
"BIC": "BANKNL2A",
"batch": True,
"creditor_id": "DE26ZZZ00000000000", # supplied by your bank or financial authority
"currency": "EUR", # ISO 4217
# "instrument": "B2B", # - default is CORE (B2C)
"address": {
# The address and all of its fields are optional but in some countries they are required
"address_type": "ADDR", # valid: ADDR, PBOX, HOME, BIZZ, MLTO, DLVY
"department": "Head Office",
"subdepartment": None,
"street_name": "Musterstr.",
"building_number": "1",
"postcode": "12345",
"town": "Berlin",
"country": "DE",
"country_subdivision": None,
"lines": ["Line 1", "Line 2"],
},
}
sepa = SepaDD(config, schema="pain.008.001.02", clean=True)
payment = {
"name": "Test von Testenstein",
"IBAN": "NL50BANK1234567890",
"BIC": "BANKNL2A",
"amount": 5000, # in cents
"type": "RCUR", # FRST,RCUR,OOFF,FNAL
"collection_date": datetime.date.today(),
"mandate_id": "1234",
"mandate_date": datetime.date.today(),
"description": "Test transaction",
# "endtoend_id": str(uuid.uuid1()).replace("-", ""), # autogenerated if obmitted
"address": {
# The address and all of its fields are optional but in some countries they are required
"address_type": "ADDR", # valid: ADDR, PBOX, HOME, BIZZ, MLTO, DLVY
"department": "Head Office",
"subdepartment": None,
"street_name": "Musterstr.",
"building_number": "1",
"postcode": "12345",
"town": "Berlin",
"country": "DE",
"country_subdivision": None,
"lines": ["Line 1", "Line 2"],
},
}
sepa.add_payment(payment)
print(sepa.export(validate=True))
Credit transfer
Example:
from sepaxml import SepaTransfer
import datetime, uuid
config = {
"name": "Test von Testenstein",
"IBAN": "NL50BANK1234567890",
"BIC": "BANKNL2A",
"batch": True,
# For non-SEPA transfers, set "domestic" to True, necessary e.g. for CH/LI
"currency": "EUR", # ISO 4217
"address": {
# The address and all of its fields are optional but in some countries they are required
"address_type": "ADDR", # valid: ADDR, PBOX, HOME, BIZZ, MLTO, DLVY
"department": "Head Office",
"subdepartment": None,
"street_name": "Musterstr.",
"building_number": "1",
"postcode": "12345",
"town": "Berlin",
"country": "DE",
"country_subdivision": None,
"lines": ["Line 1", "Line 2"],
},
}
sepa = SepaTransfer(config, clean=True)
payment = {
"name": "Test von Testenstein",
"IBAN": "NL50BANK1234567890",
"BIC": "BANKNL2A",
"amount": 5000, # in cents
"execution_date": datetime.date.today() + datetime.timedelta(days=2),
"description": "Test transaction",
# "endtoend_id": str(uuid.uuid1()).replace("-", ""), # optional
"address": {
# The address and all of its fields are optional but in some countries they are required
"address_type": "ADDR", # valid: ADDR, PBOX, HOME, BIZZ, MLTO, DLVY
"department": "Head Office",
"subdepartment": None,
"street_name": "Musterstr.",
"building_number": "1",
"postcode": "12345",
"town": "Berlin",
"country": "DE",
"country_subdivision": None,
"lines": ["Line 1", "Line 2"],
},
}
sepa.add_payment(payment)
print(sepa.export(validate=True))
Development
To run the included tests:
pip install -r requirements_dev.txt py.test tests
To automatically sort your Imports as required by CI:
pip install isort isort -rc .
Credits and License
Maintainer: Raphael Michel <mail@raphaelmichel.de>
This basically started as a properly packaged, python 3 tested version of the PySepaDD implementation that was released by The Congressus under the MIT license. Thanks for your work!
License: MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sepaxml-2.6.1.tar.gz
.
File metadata
- Download URL: sepaxml-2.6.1.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 939c12236779e6a3d7221d3557921abd6e30b0bfd369e67815ea55bccaacd688 |
|
MD5 | d9727a36ad9af08d6fd6f5d4300a988b |
|
BLAKE2b-256 | 2238dd0d802f03025acd15b20ab8180ef4d3a90c6478b5d43a4c11606c5b723e |
File details
Details for the file sepaxml-2.6.1-py3-none-any.whl
.
File metadata
- Download URL: sepaxml-2.6.1-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f110e4a11322c1ea46f86550d703468b109343b4cece1d5b792d394f03d86110 |
|
MD5 | 1bed7be6eef52764559d644885197994 |
|
BLAKE2b-256 | 61b876d321077eca630b270b1ae03883936547a701a3ac8c91ad19216cf021cf |