Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MSG ID from Batch to match statements with transactions #228

Open
hey-johnnypark opened this issue Apr 13, 2022 · 0 comments · May be fixed by #230
Open

Use MSG ID from Batch to match statements with transactions #228

hey-johnnypark opened this issue Apr 13, 2022 · 0 comments · May be fixed by #230
Assignees

Comments

@hey-johnnypark
Copy link
Collaborator

CURRENT

EREF is used to match statements and transactions.

 def self.link_statement_to_transaction(account, statement)
        # find transactions via EREF
        transaction = account.transactions_dataset.where(eref: statement.eref).first

PROBLEM

We know that at least one bank (Postbank) does not add the EREF to the statements for each transaction. This results in transactions staying in status order_final_hac_pos instead of e.g. funds_credited.

We also can share an E-Mail from Postbank ( as it does not reveal any private information).

Bei der Beauftragung senden Sie uns einen Sammel-Lastschriftauftrag mit X Stück Einzel-Lastschriften. Auf Ihrem Konto wird der Auftrag in einer Summenbuchung dargestellt. Die Einzeltransaktionen werden Ihnen nicht dargestellt. Darum sehen Sie auch nicht die einzelnen EndToEndId’s.

Sie finden als Umsatz die Summenbuchung Ihres Auftrages mit Ihrer EBICS-BOX/123 und EBICS-BOX/123/1.

Hier taucht dann wieder Ihre Gesamtsumme vom Auftrag auf.

Das bedeutet, dass Sie nur die Ausführung und Erledigung Ihres gesamten Auftrages prüfen müssen. Nicht jede einzelne Lastschrift.

Die EndToEndId’s erhalten Sie aber bei einer Lastschrift-Retoure zurück. So können Sie anhand der EndToEndId auswerten, bei welcher Lastschrift die Zahlung nicht erfolgreich war.

SUGGESTED SOLUTION

  • When a new direct_debit is created, the batch_msg_id (EBICS-BOX/123) is stored in the transaction
  • When a new statement is created, we add a fallback match similar to this.
 def self.link_statement_to_transaction(account, statement)
        # find transactions via EREF
        transaction = account.transactions_dataset.where(eref: statement.eref).first
        transaction ||= account.transactions_dataset.where { created_at > 14.days.ago }.detect { |t| statement.information =~ /#{t.batch_msg_id}/i }

LOOKING FORWARD

In the future, it would be good to submit orders containing more than one transaction. This will reduce costs for the creditors. This issue will contribute to that.

@hey-johnnypark hey-johnnypark self-assigned this Apr 13, 2022
hey-johnnypark pushed a commit that referenced this issue Apr 13, 2022
…n. Adds test cases. Removes exclude statement (credit_received and debit_received are not the correct values in any case)
hey-johnnypark pushed a commit that referenced this issue Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant