SEPA Reason Codes distributed as Ruby Gem

by Sahil Gadimbayli, Founder / Senior Engineer

Working with Ebics (Electronic Banking Internet Communication Standard) and European banking transactions, you may have come across with SEPA Reason Codes.

I am not going to explain their role within Ebics as it's already very well explained by European council here.

Basically, these are the codes that are used in exception handling of bank transactions. When something goes wrong, they have a code for it.

Problem

When we were working with a client, we had to parse and update transactions in their system by reading their bank statements within a Rails application. We had to:

  • Parse the bank statement and find the reason code
  • Identify what the code actually means in order to save it in the transactions table

We had a hard time for finding a complete list, parsing and using information about SEPA Reason Codes.

After digging a little while, we have found this source, fixed a few typos here and there and finished the feature.

Solution - SepaReasonCodes GEM

We have released SepaReasonCodes gem today in case you also have this problem and can make use of it.

RubyGems https://rubygems.org/gems/sepa_reason_codes

Github: https://github.com/ramblingcode/sepa-reason-codes

Usage

Add this to your gemfile

gem 'sepa_reason_codes'

No magic here! Just pass in the reason code and get back a SepaReasonCodes::Code instance with all required information.

reason_code = SepaReasonCodes.find("AC01")

puts reason_code.code # AC01
puts reason_code.iso_name # Incorrect Account Number
puts reason_code.description # Account number is invalid or missing.
puts reason_code.probable_status # declined

SepaReasonCodes does not have any dependency or magic. Just check lib/reason_codes.yml to see the list of all reason codes.

You can also retrieve the complete list of codes by running:

SepaReasonCodes.all

which will return a collection of SepaReasonCodes::Code.

Thank you for checking SepaReasonCodes out and hope it can be of any use for you or your project!

More articles

Dumping and restoring data between different Schemas in Postgres

Going from multiple database setup into a single database with multiple schemas, we will go through the process of dumping and restoring data between different schemas in PostgreSQL.

Read more

Adding index to text columns in Postgres

Speed up your queries by adding index to text columns in Postgres using gin strategy.

Read more

Tell us about your project

lightfulweb OÜ

  • Tallin
    Sepapaja tn 6
    15551 Tallin, Estonia