0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
For generating payment files for various banks
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 10.0
~> 3.5
~> 0.12

Runtime

 Project Readme

BankPayments

Coverage Status Build Status

Ruby implementation of bank payments. Starting with

  • Swedbank International Payment, in SPISU-format

Installation

Add this line to your application's Gemfile:

gem 'bank_payments'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bank_payments

International Payments

Note that the Swedbank file is in an older format (SPISU). In about six months the Swedish standard will be based on ISO 20022 SEPA (Single Euro Payments Area). At the time of this writing (2016-08-09) there are two alternative gems for this standard:

When possible one should consider moving over to that standard instead.

Usage

For anyone using a communications protocol to relay information from one party to another the important part is not the protocol itself. It's the information that needs to be sent. In order to send the information you need two pieces of information about the transaction: The beneciciary and the transactional data itself.

Create a beneficiary

b = BankPayments::Beneficiary.new do |b|
  b.name         = 'Some company AO'
  b.address      = 'Byvägen 12 731 00 Rala'
  b.country_code = 'FI'
  b.bank_id      = 'HELSFIHH'
  b.account      = '10278'
end

Create a transaction

t = BankPayments::Transaction.new(
  amount_sek:     100_000,
  amount_foreign: 1_189_104.93,
  currency:       'JPY',
  message:        'Payment, Bill 99',
  pay_date:       Date.new(2016,8,9),
  reason:         101
)

Create a sequence, add payment and add it to a file

s = BankPayments::SwedbankExport::Sequence.new(account, name, address)
s.add_transaction(b, t)

f = BankPayments::SwedbankExport::File.new('file_name')
f << s
f.to_file_data

Download the result of f.to_file_data and upload it to the bank. The important part here is to setup the beneficiary and transactions correctly.

Use yard to generate the gem documentation which will give you more information about the implementation.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/apoex/bank_payments.

License

The gem is available as open source under the terms of the MIT License.