File: README.rst

package info (click to toggle)
python-sepaxml 2.6.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 328 kB
  • sloc: python: 3,951; makefile: 4
file content (178 lines) | stat: -rw-r--r-- 5,313 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
SEPA XML Generator
==================

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

.. image:: https://codecov.io/gh/raphaelm/python-sepaxml/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/raphaelm/python-sepaxml

.. image:: http://img.shields.io/pypi/v/sepaxml.svg
   :target: https://pypi.python.org/pypi/sepaxml

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:

.. code:: python

    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:

.. code:: python

    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

.. _PySepaDD: https://github.com/congressus/PySepaDD