-
Notifications
You must be signed in to change notification settings - Fork 11
Description
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.