Skip to content

Latest commit

 

History

History
125 lines (90 loc) · 2.98 KB

README.rst

File metadata and controls

125 lines (90 loc) · 2.98 KB

SEPA XML Generator

https://travis-ci.org/raphaelm/python-sepaxml.svg?branch=master

This is a python implementation to generate SEPA XML files.

Limitations

Supported standards:

  • SEPA PAIN.001.001.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)
}
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())  # autogenerated if obmitted
}
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
}
sepa = SepaTransfer(config, clean=True)

payment = {
    "name": "Test von Testenstein",
    "IBAN": "NL50BANK1234567890",
    "BIC": "BANKNL2A",
    "amount": 5000,  # in cents
    "execution_date": datetime.date.today(),
    "description": "Test transaction",
    # "endtoend_id": str(uuid.uuid1())  # optional
}
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 <[email protected]>

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