my-flow / fintex

Elixir-based client library for HBCI 2.2 and FinTS 3.0
Other
27 stars 17 forks source link

Transaction: Whitespace in purpose #11

Closed thorsten-de closed 7 years ago

thorsten-de commented 7 years ago

To create a transaction from a statement, the purpose is set by joining the details, separated with " ". That gets some weird looking purpose lines, with spaces in the middle of a customer id for example. I just can't recognize if that space was part of the transaction data or just of the joining process.

I'd rather like to get the raw list of lines and join it as I need. Also, having all that SEPA-Identifiers like SVWZ+, I have to do some splitting anyway...

my-flow commented 7 years ago

Thanks, @thorsten-de. These are 2 different problems:

(…) purpose is set by joining the details, separated with " ". (…) I just can't recognize if that space was part of the transaction data or just of the joining process.

Agreed. Adding extra whitespace to the purpose is confusing. I will join the details without additional whitespace.

I'd rather like to get the raw list of lines and join it as I need. Also, having all that SEPA-Identifiers like SVWZ+, I have to do some splitting anyway...

I would argue that the FinTex library should provide the transaction purpose as a joined string (and not as a raw list of lines), because there is no additonal value in delivering the raw lines. In other words: In almost all use cases the raw lines would be joined by the user of the FinTex library anyway.

Let’s look at this example, taken from a sepa_snippet.sta test case:

?20EREF+EndToEndId TFNR 22 004?21 00001?22SVWZ+Verw CTSc-01 BC-PPP TF?23Nr 22 004

When trying to filter out SEPA identifiers (such as SVWZ+), how would the raw lines help you here compared to a joined string?

[
  "EREF+EndToEndId TFNR 22 004",
  " 00001",
  "SVWZ+Verw CTSc-01 BC-PPP TF",
  "Nr 22 004"
]
my-flow commented 7 years ago

I had a closer look at same real-life purposes (and not only at the test cases of this project).

Admittedly, in some cases the raw list of lines can be joined with a space and in other cases without a space. Unfortunately, I was not able to detect a consistent pattern because some banks split the purpose lines based on word boundaries and others based on max line length.

Thus, I suppose the most useful data this library can provide is a raw list of lines. The user of the FinTex library must decide if it makes sense to join the purpose lines or not.