Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Issue in transaction ID generation #20

Open
MollardMichael opened this issue Oct 5, 2021 · 0 comments
Open

Issue in transaction ID generation #20

MollardMichael opened this issue Oct 5, 2021 · 0 comments

Comments

@MollardMichael
Copy link

MollardMichael commented Oct 5, 2021

Hello,

I must first thank you for your work as this has helped us a lot.

I found an issue during transaction ID generation that you might want to fix.

I have a statement that ended up with the same transaction id for two distinct transactions.
The current implementation seems to do a hash of the transaction but the issue stem from the fact that this generation is done before adding the description on the transaction object.

This is where the hash is computed but at that time, the description hasn't been updated/parsed yet
https://github.com/webschik/mt940-js/blob/master/src/tags/transaction-info.ts#L128

I ended up with the following transactions.

As you can see the only thing that differ is the description but as it is not used during id computation, I ended up with the same ID

{
          id: "62b7488d42b4d11470952584b06bbfa8",
          code: "NTRF",
          amount: 500,
          currency: "EUR",
          isCredit: true,
          entryDate: "2021-09-23",
          fundsCode: "",
          isExpense: true,
          valueDate: "2021-09-24",
          description:
            "/TYPE/0568/VIR SEPA RECU/CODE/FR/18//RBR /ZZ1AJ3Z84ZGZNLM/SDT /20210924/NBTR/1/MID /ZZ1AJ3Z84ZGZNLMO0/ULTD//ID/0000000",
          bankReference: "",
          customerReference: "",
        },
        {
          id: "62b7488d42b4d11470952584b06bbfa8",
          code: "NTRF",
          amount: 500,
          currency: "EUR",
          isCredit: true,
          entryDate: "2021-09-23",
          fundsCode: "",
          isExpense: true,
          valueDate: "2021-09-24",
          description:
            "/TYPE/0568/VIR SEPA RECU/CODE/FR/18//RBR /ZZ1AJ4W6JW0BQFB/SDT /20210924/NBTR/1/MID /ZZ1AJ4W6JW0BQFBWB/ULTD//ID/0000000",
          bankReference: "",
          customerReference: "",
        }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant