Git Product home page Git Product logo

python-sepaxml's Introduction

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

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 <[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!

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.

python-sepaxml's People

Contributors

alphanoob1337 avatar bibz avatar chdecultot avatar debruinf avatar dviejopomata avatar guettli avatar haraldschilly avatar henryk avatar jan-janssen avatar lutoma avatar marcelwaldvogel avatar oe1rfc avatar paurosello avatar raphaelm avatar simone-pignotti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-sepaxml's Issues

Missing Copyright statement

In README.rst you give credit to The Congressus but you fail to keep the Copyright line

Copyright (c) 2014 Congressus, The Netherlands

as required by the MIT license.

Batch Booking = False

Thank you for this great package!

I want to create a collective SEPA transfer where the structure of the generated XML has the one of setting "batch": True, however, the entry <BtchBookg> in the resulting XML should be false.

Background: This is how Commerzbank wants SEPA XMLs to be formatted when no batch booking is wanted. Unfortunately, setting "batch": False during the generation process results in an XML that Commerzbank is not able to parse.

Your help is very much appreciated.

Issue with tags in {urn:iso:std:iso:20022:tech:xsd:pain.001.001.03}CstmrDrctDbtInitn

Hi there!
Using the SepaDD as follows:

## Config file
        config = {
            "name": "name",
            "IBAN": "AD121111111111111111111",
            "creditor_id": "AD121111111111111111111",  # TODO update -  supplied by your bank or financial authority
            "BIC": "CRDAADAD",
            "batch": True,
            "domestic": True,
            "currency": "EUR",  # ISO 4217
        }
        sepa = SepaDD(config, schema="pain.001.001.03", clean=True)
        # Adding payments Iteratively

I get the following error message:
Reason: Unexpected child with tag '{urn:iso:std:iso:20022:tech:xsd:pain.001.001.03}CstmrDrctDbtInitn' at position 1. Tag 'CstmrCdtTrfInitn' expected.

Has it happened to anyone else?
Thanks!

Improvement: `utils.make_msg_id` uses `time` but `_create_header` uses `datetime`

String-ified timestamps are generated in two different ways in the library:

  1. sepaxml.utils.make_msg_id relies on the time module to generate the timestamp part of the message ID
  2. sepaxml.debit._create_header and sepaxml.transfer._create_header rely on the datetime module for a similar feature (the timestamp in the message header)

The problem caused by 1) is that popular (date-)time mocking methods (e.g. mocking the datetime module, or using freezegun) do not work for both at once.

Use-case: I want to have a reproducible XML export in my test suite.
I thought everything was working fine with freezegun but the CI/CD pipeline highlighted the flakiness of my mock.
datetime is mocked alright, but time still relies on the machine local timezone offset, not on the mocked value.

I will open a PR with my very naive solution: using datetime in sepaxml.utils.make_msg_id to generate the timestamp.

Example for direct debit contains invalid end to end reference

The example from the readme proposed tu use a UUID1 as end-to-end reference. However, the string representation of a UUID1 is 36 characters, while SEPA allows only 35 characters in the end-to-end reference. The example from the readme thus fails the validation when creating the XML.

Support country/address fields for international transfers

International transfers to some countries need country and postal address fields (Switzerland at least it seems, others like Danske bank mark this field as optional).

These are currently not supported:

    <!-- from  -->
    <Dbtr>
      <Nm>XXXXX</Nm> 
      <PstlAdr>
        <PstCd>75001</PstCd>
        <TwnNm>TwnNm</TwnNm>>
        <Ctry>CC</Ctry>
        <AdrLine>XXXXXX </AdrLine>
        <AdrLine>XXXXXX </AdrLine>
      </PstlAdr>
      <Id>
        <OrgId>
          <Othr>
          </Othr>
        </OrgId>
      </Id>
    </Dbtr>

It would be nice to support international DD from these countries.

`pain.001.001.03` raises `sepaxml.validation.ValidationError` with example data

With the example data from the README, I get an

xmlschema.validators.exceptions.XMLSchemaChildrenValidationError: failed validating <Element '{urn:iso:std:iso:20022:tech:xsd:pain.001.001.03}Document' at 0x101f3d188> with XsdGroup(model='sequence', occurs=[1, 1]):

Reason: Unexpected child with tag '{urn:iso:std:iso:20022:tech:xsd:pain.001.001.03}CstmrDrctDbtInitn' at position 1. Tag 'CstmrCdtTrfInitn' expected.

Schema:

  <xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Document">
      <xs:sequence>
          <xs:element name="CstmrCdtTrfInitn" type="CustomerCreditTransferInitiationV03" />
      </xs:sequence>
  </xs:complexType>

Can you guess what's going wrong?

How to provide "Kundendaten" (customer reference) to a SEPA transfer?

When issuing a SEPA transfer via online banking, one can provide both a description as well as a customer/payment reference ("Kundendaten") value. The latter would be where one can insert the invoice number for example, which this transfer would be the payment for.

How can I provide this reference number with python-sempaxml via add_payment()?

Support for RuleBook 6 of pain.001.001.03 schema

I need to create the SEPA XML for an Austrian bank. Unfortunately here in Austria the latest version of the pain.001.001.03 schema is not supported yet, we use the RuleBook 6 version of that schema:

https://zv.psa.at/de/download/xml/archiv/rb-60/12-isopain00100103austrian003/file.html

When I copy over that .xsd file into the sepaxml/schemas folder and run my script, I get the following exception:

sepa = SepaTransfer(config, clean=True, schema="ISO.pain.001.001.03.austrian.003")
...  # adding payments
sepa_xml = sepa.export(validate=True, pretty_print=False)
---------------------------
Exception has occurred: XMLSchemaParseError
unknown type 'AT_ExternalCategoryPurpose1Code':

Schema:

  <xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Cd" type="AT_ExternalCategoryPurpose1Code" />

Path: /xs:schema/xs:complexType[75]/xs:complexContent/xs:restriction/xs:sequence/xs:choice/xs:element[1]

Schema URL: file:///home/mfb/.local/lib/python3.10/site-packages/sepaxml/schemas/ISO.pain.001.001.03.austrian.003.xsd

Any ideas how I could fix this?

SEPA error

When uploading the SEPA files to test-services like mobilefish.com, I keep receiving the same error: "Element '{urn:iso:std:iso:20022:tech:xsd:pain.001.001.03}CstmrDrctDbtInitn': This element is not expected. Expected is ( {urn:iso:std:iso:20022:tech:xsd:pain.001.001.03}CstmrCdtTrfInitn ).
". How can I change "CstmrDrctDbtInitn" to "CstmrCdtTrfInitn" ? Help is very appreciated!

thanks.

Add option to limit size of batch

At my bank, there is a limit to the amount of transactions in a single batch (which is 500). If there are more than 500 items in a batch, it is rejected.

It would be really helpful if sepadd allowed for either specifying the batch the transaction gets added to, or automatically selecting a new batch when a limit is reached.

pip install doesn't work with Python3.7

Hi all,

pip install sepa xml doesn't work with python 3.7 and pip 18.1.
There is a syntax error in validation.py

Following, the error found

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-RIMfI7/sepaxml/setup.py", line 6, in
from sepaxml import version
File "sepaxml/init.py", line 1, in
from .debit import SepaDD # noqa
File "sepaxml/debit.py", line 4, in
from .shared import SepaPaymentInitn
File "sepaxml/shared.py", line 5, in
from .validation import try_valid_xml
File "sepaxml/validation.py", line 18
) from e
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-RIMfI7/sepaxml/

Payments from multi-currency bank accounts

Hello!
Some bank offers multi currency accounts, when under the same account number you have separate accounts for different currencies. Such banks expect to receive <Ccy> in <DbtrAcct>:

<DbtrAcct>
 <Id><IBAN>CZ7855000000005001264780</IBAN></Id>
  <Ccy>EUR</Ccy>
</DbtrAcct>

It seems that the library does not support it now. Do you consider having it?

If I submit a PR, how would you like it to be implemented? multi_currency=True in config or something else?

Output for 2 digit amounts is incorrect

Thanks for your work on the sepaxml library.

I’ve found a small bug where amounts in cents with 2 digits are converted to ".24" instead of "0.24". I have a PR ready but couldn’t find a policy for submitting.

How to use the structured reference field for a SEPA payment?

In SEPA PAIN.001 standard there are two fields for payment references - structured (<Strd>) and unstructured (<Ustrd>). Here in python-sepaxml one can use the description field in the payment information for the latter. But how can I fill the structured reference?

Broken FinInstnId

Adding a payment without BIC leads to a broken <FinInstnId>

It should look like this:

<DrctDbtTxInf> ... <DbtrAgt> <FinInstnId> <Othr> <Id>NOTPROVIDED</Id> </Othr> </FinInstnId> </DbtrAgt> ... </DrctDbtTxInf>

But instead I receive that output:

<DrctDbtTxInf> ... <DbtrAgt> <FinInstnId/> </DbtrAgt> ... </DrctDbtTxInf>

I'm not sure, but I think in debit.py line 268 and line 269 have to be swapped with each other.

Add schema validation

Would be great to include the pain...xsd schema files and include schema validation in the generation process (maybe make it opt-out so that people who know they're doing everything right can disable it if they want to generate thousands of messages per second and think validation is slowing them down).

Background: IMHO the library should prevent the library user (the programmer) from doing obviously incorrect things/producing invalid messages. On my first attempt I violated the XSD constraints for the mandate_id, and the bank response was a simple "SEPA-Nachrichtenformat ungültig.". Builtin schema validation (I hope it's merely adding a python dependency and adding a function call) could prevent this.

possible xmlschema 1.1.0 incompatibility

Hi,

I've just noticed that my script using fints no longer works. It looks like a recent release of xmlschema brings some incompatibility. Not sure if this is a fints bug though. This is the stacktrace:

    return client.get_balance(account).amount.amount
  File "…/python-fints/lib/python3.7/site-packages/fints/client.py", line 628, in get_balance
    response = self._send_with_possible_retry(dialog, seg, self._get_balance)
  File "…/python-fints/lib/python3.7/site-packages/fints/client.py", line 1234, in _send_with_possible_retry
    response = dialog.send(command_seg)
  File "…/python-fints/lib/python3.7/site-packages/fints/dialog.py", line 156, in send
    self.client.process_response_message(self, response, internal_send=internal_send)
  File "…/python-fints/lib/python3.7/site-packages/fints/client.py", line 241, in process_response_message
    self._process_response(dialog, segment, response)
  File "…/python-fints/lib/python3.7/site-packages/fints/client.py", line 1284, in _process_response
    raise FinTSClientError("Error during dialog initialization, could not fetch BPD. Please check that you "
fints.exceptions.FinTSClientError: Error during dialog initialization, could not fetch BPD. Please check that you passed the correct bank identifier to the HBCI URL of the correct bank.

What works:

  • sepaxml==2.1.1 and xmlschema==1.0.18

What no longer works for me:

  • sepaxml==2.1.1 and xmlschema==1.1.0
  • sepaxml==2.2.0 and xmlschema==1.1.0

Add multiple PaymentInformation into the SEPA SDD

In the "CFONB" (french bank norm concil) it states that the "PaymentInformation" block may be repeated.

Reading the code, it would be quite a remake...

1/ On my side, build several SepaSDD, and "merge" XMLs.
2/ On Project Side, add a layer to code, such as :

import datetime, uuid

config1 = {
    "name": "Test von Testenstein 1",
    "IBAN": "NL50BANK000000001",
    ...
}
config2 = {
    "name": "Test von Testenstein 2",
    "IBAN": "NL50BANK000000002",
    ...
}

## This creates a sepa and adds first creditor as config1.
## This is supposed to be exactly as "before", not breaking working code everywhere :-)
sepa = SepaDD(config1, schema="pain.008.001.02", clean=True)
sepa.add_payment(payment_a)
sepa.add_payment(payment_b)
sepa.add_payment(payment_c)

## we define a new creditor from now on...
sepa.new_creditor(config2)
sepa.add_payment(payment_d)

print(sepa.export(validate=True))

Sparkasse compatibility

I had to do the following modifications to make it compatible with Sparkasse:

xml = re.sub(r'<PmtInfId>.+</PmtInfId>', '<PmtInfId>NOTPROVIDED</PmtInfId>', xml)
xml = re.sub(r'.+<PmtTpInf>[\S\n ]+?</PmtTpInf>\n', '', xml)
xml = re.sub(r'.+<CdtrAgt>[\S\n ]+?</CdtrAgt>\n', '', xml)
xml = re.sub(r'.+<BtchBookg>[\S\n ]+?</BtchBookg>\n', '', xml)

Maybe these could be options for python-sepaxml.

Do not use this

Author has lost interest (see issue list).
Probably does not support the SEPA version your bank wants from you.

Add optional pretty printing and/or writing to file

I know the code is easy enough to write yourself. But it would be convenient if the export function would take an optional filename parameter to write to. And an optional keyword argument pretty=True to make the output human readable.

Exception "cannot import name 'Counter'" when calling export(validate=True)

Version:
sepaxml==2.5.0

Got following exception when calling "export(validate=True)"

2022-01-13 18:05:28 [13/Jan/2022 18:05:28] ERROR [sepa_xml:42] Exception: cannot import name 'Counter' 

Traceback (most recent call last):
#012  File "./prj/sepa_xml.py", line 38, in generate_sepa_xml
#012    return _sepa.export(validate=True)
#012  File "/home/user/.virtualenvs/EXP3.6/lib/python3.6/site-packages/sepaxml/shared.py", line 99, in export
#012    try_valid_xml(out, self.schema)
#012  File "/home/user/.virtualenvs/EXP3.6/lib/python3.6/site-packages/sepaxml/validation.py", line 9, in try_valid_xml
#012    import xmlschema  # xmlschema does some weird monkeypatching in etree, if we import it globally, things fail
#012  File "/home/user/.virtualenvs/EXP3.6/lib/python3.6/site-packages/xmlschema/__init__.py", line 20, in <module>
#012    from .dataobjects import DataElement, DataElementConverter, DataBindingConverter
#012  File "/home/user/.virtualenvs/EXP3.6/lib/python3.6/site-packages/xmlschema/dataobjects.py", line 27, in <module>
#012    from . import validators
#012  File "/home/user/.

Seems that global_maps.py within xmlschema has this line:
from collections import Counter

So probably that one fails, but why?

Validation error for DD with empty BIC field

If the BIC is empty (optional for national transfers in countries like Germany), the validation fails with error:

    print(sepa.export(validate=True))
  File "/usr/local/lib/python3.7/dist-packages/sepaxml/shared.py", line 92, in export
    "The output SEPA file contains validation errors. This is likely due to an illegal value in one of "
sepaxml.validation.ValidationError: The output SEPA file contains validation errors. This is likely due to an illegal value in one of your input fields.

Docs: FRST,RCUR,OOFF,FNAL

Hi,

please provide a hyperlink in the README where I can find more information about the types (FRST,RCUR,OOFF,FNAL).

Thank you

InitgPty missing in PAIN.008.001.02

Hello, I am trying to make an import of SEPA debts for a bank in Spain with schema pain.008.001.02. It tells me in the errors that the identification of the creditor in the header is missing. I have been consulting the documentation of several banks and in all of them, it indicates that the InitgPty element must be added to it. I leave a link to the documentation of a couple of European banks.
https://businessbanking.bankofireland.com/fs/doc/wysiwyg/sepa-direct-debit-pain-008-001-02-xml-file-structure-july-2013.pdf
https://www.handelsbanken.com/shb/inet/icentsv.nsf/vlookuppics/a_filmformatbeskrivningar_fil_iso_20022_xml_pain_008_001_02_direct_debit/$file/iso_pain_008_001_02_direct_debit.pdf

This element is also included in the message definitions on the web iso20022.org
https://www.iso20022.org/documents/messages/1_0_version/pain/schemas/pain.001.001.02.zip

saving the SEPA file

Hello, I can't find a way to save the created SEPA file. Could you give an example on how to do this?
Also, when I try to change the type from for instance "pain.008.002.02" to "PAIN.001.001.03". The error message I get is as follows: "The output SEPA file contains validation errors. This is likely due to an illegal value in one of your input fields"

Many thanks in advance.

schemas/ folder not getting installed

While running the python-fints tests I ran into this error:

E           FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3.7/site-packages/sepaxml/schemas/pain.001.001.03.xsd'

It seems this is due to python-sepaxml not installing that folder. To install python-sepaxml I'm using:

python setup.py install -O1 --root="${pkgdir}"

I'm using the 2.1.0 release tar ball available on github.

CBI compatibility

Hello,

I would like to have compatibility with the CBI standard, which is derived from the ISO20022 pain.001.001.03

These are some useful files and links:
STIP-ST-001 Credit Transfer CBI v.00.04.00.xls

SEPA Single Euro Payments Area.pdf

https://remote.cedbrianteo.it/PagheWEB/help/infinity/ITA/mergedProjects/Infinity_PagheWeb/intro/intro_tracciati_record_accredito_netti.htm

Needed:

  1. add a new schemas for validation of the standard: https://github.com/raphaelm/python-sepaxml/tree/master/sepaxml/schemas
    Here there is a schema which could be used to ease the work: https://github.com/linkmesrl/cbi/blob/master/lib/xsd/CBIPaymentRequest.00.04.00.xsd
  2. add tests: https://github.com/raphaelm/python-sepaxml/tree/master/tests
  3. add support (for both SEPA and CBI) for Structured Credit Transfer Transaction Information (tag: 'Strd'), right now only Unstructured (Ustrd) is supported

This is a test xml downloaded from my bank with some parameter hidden for privacy:

<?xml version="1.0" encoding="utf-8"?>
<DEF:CBIBdyPaymentRequest
	xmlns="urn:CBI:xsd:CBIBdyPaymentRequest.00.04.00"
	xmlns:DEF="urn:CBI:xsd:CBIBdyPaymentRequest.00.04.00"
	xmlns:PMRQ="urn:CBI:xsd:CBIPaymentRequest.00.04.00"
	xmlns:SGNT="urn:CBI:xsd:CBISgnInf.001.04">
	<DEF:CBIEnvelPaymentRequest>
		<DEF:CBIPaymentRequest>
			<PMRQ:GrpHdr>
				<PMRQ:MsgId>unique id</PMRQ:MsgId>
				<PMRQ:CreDtTm>2021-04-14T00:00:00</PMRQ:CreDtTm>
				<PMRQ:NbOfTxs>1</PMRQ:NbOfTxs>
				<PMRQ:CtrlSum>36.60</PMRQ:CtrlSum>
				<PMRQ:InitgPty>
					<PMRQ:Id>
						<PMRQ:OrgId>
							<PMRQ:Othr>
								<PMRQ:Id>id</PMRQ:Id>
								<PMRQ:Issr>CBI</PMRQ:Issr>
							</PMRQ:Othr>
						</PMRQ:OrgId>
					</PMRQ:Id>
				</PMRQ:InitgPty>
			</PMRQ:GrpHdr>
			<PMRQ:PmtInf>
				<PMRQ:PmtInfId>unique id</PMRQ:PmtInfId>
				<PMRQ:PmtMtd>TRA</PMRQ:PmtMtd>
				<PMRQ:PmtTpInf>
					<PMRQ:InstrPrty>NORM</PMRQ:InstrPrty>
					<PMRQ:SvcLvl>
						<PMRQ:Cd>SEPA</PMRQ:Cd>
					</PMRQ:SvcLvl>
				</PMRQ:PmtTpInf>
				<PMRQ:ReqdExctnDt>2021-04-13</PMRQ:ReqdExctnDt>
				<PMRQ:Dbtr>
					<PMRQ:Nm>we</PMRQ:Nm>
					<PMRQ:PstlAdr>
						<PMRQ:AdrLine>our address</PMRQ:AdrLine>
						<PMRQ:AdrLine>another line</PMRQ:AdrLine>
					</PMRQ:PstlAdr>
				</PMRQ:Dbtr>
				<PMRQ:DbtrAcct>
					<PMRQ:Id>
						<PMRQ:IBAN>my iban</PMRQ:IBAN>
					</PMRQ:Id>
				</PMRQ:DbtrAcct>
				<PMRQ:DbtrAgt>
					<PMRQ:FinInstnId>
						<PMRQ:ClrSysMmbId>
							<PMRQ:MmbId>bank code</PMRQ:MmbId>
						</PMRQ:ClrSysMmbId>
					</PMRQ:FinInstnId>
				</PMRQ:DbtrAgt>
				<PMRQ:ChrgBr>SLEV</PMRQ:ChrgBr>
				<PMRQ:CdtTrfTxInf>
					<PMRQ:PmtId>
						<PMRQ:InstrId>1</PMRQ:InstrId>
						<PMRQ:EndToEndId>unique id</PMRQ:EndToEndId>
					</PMRQ:PmtId>
					<PMRQ:PmtTpInf>
						<PMRQ:CtgyPurp>
							<PMRQ:Cd>SUPP</PMRQ:Cd>
						</PMRQ:CtgyPurp>
					</PMRQ:PmtTpInf>
					<PMRQ:Amt>
						<PMRQ:InstdAmt Ccy="EUR">36.60</PMRQ:InstdAmt>
					</PMRQ:Amt>
					<PMRQ:Cdtr>
						<PMRQ:Nm>my supplier</PMRQ:Nm>
						<PMRQ:PstlAdr>
							<PMRQ:StrtNm>supplier address</PMRQ:StrtNm>
						</PMRQ:PstlAdr>
						<PMRQ:Id>
							<PMRQ:OrgId>
								<PMRQ:Othr>
									<PMRQ:Id>supplier vat number</PMRQ:Id>
								</PMRQ:Othr>
							</PMRQ:OrgId>
						</PMRQ:Id>
					</PMRQ:Cdtr>
					<PMRQ:CdtrAcct>
						<PMRQ:Id>
							<PMRQ:IBAN>supplier iban</PMRQ:IBAN>
						</PMRQ:Id>
					</PMRQ:CdtrAcct>
					<PMRQ:RmtInf>
						<PMRQ:Strd>
							<PMRQ:RfrdDocInf>
								<PMRQ:Tp>
									<PMRQ:CdOrPrtry>
										<PMRQ:Cd>CINV</PMRQ:Cd>
									</PMRQ:CdOrPrtry>
								</PMRQ:Tp>
								<PMRQ:Nb>test string</PMRQ:Nb>
								<PMRQ:RltdDt>2021-04-26</PMRQ:RltdDt>
							</PMRQ:RfrdDocInf>
							<PMRQ:RfrdDocAmt>
								<PMRQ:CdtNoteAmt Ccy="EUR">36.60</PMRQ:CdtNoteAmt>
							</PMRQ:RfrdDocAmt>
						</PMRQ:Strd>
					</PMRQ:RmtInf>
				</PMRQ:CdtTrfTxInf>
			</PMRQ:PmtInf>
		</DEF:CBIPaymentRequest>
	</DEF:CBIEnvelPaymentRequest>
</DEF:CBIBdyPaymentRequest>

This issue is pubblished on bountysource
I am able to run tests to check if generated xml file are correctly accepted by my bank

Double escaping issues

At least for some characters, there seem to be double escaping issues. For example, setting name in a payment to Test & Test results in <Nm>Test &amp;amp; Test</Nm>.

The issue seems to be these:
https://github.com/raphaelm/python-sepadd/blob/6fd06341b8fa2b0b4fef48ba0b5c410d8d80a707/sepadd/debit.py#L103

Removing the escape() around the assignments in debit.py fixes this issue and results in <Nm>Test &amp; Test</Nm>, so there already seems to be some builtin escaping going on. I'm just not sure if xml.sax.saxutils.escape maybe does some additional escaping that's required?

Using Python 3.6.2 and python-sepadd 1.1.0

Copyright questions

Hi,

I was wondering how the xsd files under sepaxml/schemas/ are licensed. They seem to stem from here. The license/ term of use mentioned here and here seems to allow use. Please consider adding a proper copyright statement in the README.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.