Python SEPA XML implementations
Project description
This is a python implementation to generate SEPA XML files.
Limitations
Supported standards:
SEPA PAIN.001.001.03 (v2009)
SEPA PAIN.001.001.09 (v2019)
SEPA PAIN.001.001.10
SEPA PAIN.001.001.11
SEPA PAIN.008.001.02 (v2009)
SEPA PAIN.008.001.08 (v2019)
SEPA PAIN.008.001.09
SEPA PAIN.008.001.10
Usage
Direct debit (SDD)
Example:
from sepapy import SepaDebit
import datetime, uuid
config = {
"msg_id": "EXAMPLE-SDD-PAIN88-TEST",
"name": "Musée du SEPA",
"IBAN": "FR7610071750000012345678944",
"BIC": "TRPUFRP1",
"batch": True,
"creditor_id": "FR82ZZZ00000000000", # Identifier Creditor SEPA (ICS), 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
"department": "Bureau de la conservation",
"subdepartment": None,
"street_name": "rue de la Banque",
"building_number": "666",
"postcode": "75002",
"town": "Paris",
"country": "FR",
"country_subdivision": None,
},
}
sepa = SepaDebit(config, schema="pain.008.001.08", clean=True)
payment1 = {
"name": "Client Lambda",
"IBAN": "FR7610107012340012345678952",
"BIC": "BREDFRPPXXX",
"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": "AC12345678-DFT-SDD-25001-001", #str(uuid.uuid1()).replace("-", ""), # autogenerated if obmitted
"address": {
# The address and all of its fields are optional but in some countries they are required
"lines": ["1 rue du Client", "59000 Lille"],
},
}
payment2 = {
"name": "SARL Lambda",
"IBAN": "FR7620041010059876543210065",
"BIC": "PSSTFRPPXXX",
"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": "AC12345678-DFT-SDD-25001-002", #str(uuid.uuid1()).replace("-", ""), # autogenerated if obmitted
"address": {
# The address and all of its fields are optional but in some countries they are required
"department": "Comptabilite",
"subdepartment": None,
"street_name": "rue des Immeubles-Industriels",
"building_number": "123",
"postcode": "75011",
"town": "Paris",
"country": "FR",
"country_subdivision": None,
},
}
sepa.add_payment(payment1)
sepa.add_payment(payment2)
print(sepa.export(validate=True, pretty_print=True))
Credit transfer (SCT)
Example:
from sepapy import SepaCredit
import datetime, uuid
config = {
"msg_id": "EXAMPLE-SCT-PAIN19-TEST",
"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 = SepaCredit(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, pretty_print=True))
Development
To run the included tests:
pip install -r requirements_dev.txt py.test tests
Credits and License
Maintainer: Philippe-Alexandre PIERRE <philippe-alexandre.pierre@dgfip.finances.gouv.fr>
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!
This basically continued as a properly packaged, python 3 tested version of the python-sepaxml implementation that was released by aphael Michel under the MIT license. Thanks for your work!
The source code is released under MIT license.
Not part of the MIT-licensed project are the XML schemas in the sepaxml/schemas/ folder which are copyrighted by the ISO 20022 organization but allowed to be reproduced freely.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sepapy-2.6.2.tar.gz.
File metadata
- Download URL: sepapy-2.6.2.tar.gz
- Upload date:
- Size: 52.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba27282674af165cf291ff8c32fc9750875a7ca4a1e86d891053589c35720221
|
|
| MD5 |
a09325eb709bf6e757cee95ffc4afbec
|
|
| BLAKE2b-256 |
24e4e675e54c682c659d156a5ec6b544763f786a3551dc4c13b479a0e33c95a6
|
File details
Details for the file sepapy-2.6.2-py3-none-any.whl.
File metadata
- Download URL: sepapy-2.6.2-py3-none-any.whl
- Upload date:
- Size: 61.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f549a101356872d4554ee5f41ba6e3c8e8d77f5866a0d5a3bbf5a53f7d350fd
|
|
| MD5 |
7cb5846d96042da813b4f4bf03781ed7
|
|
| BLAKE2b-256 |
9fe2efaa3cdf61c8f684376965ef69c3153f468ead706687bb113549ef0879a6
|