Skip to content
/ hbci Public

A pure ruby HBCI client for talking with german banks

License

Notifications You must be signed in to change notification settings

fintastic/hbci

Repository files navigation

Hbci

A pure ruby HBCI client for talking with german banks

CircleCI Gem Version Depfu

Preface

This gem is considered experimental.

Installation

Add this line to your application's Gemfile:

gem 'hbci'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hbci

Usage

First, setup your credentials in a BankCredentials::Hbci instance:

credentials = BankCredentials::Hbci.new({
  url:        'url',
  bank_code:  'bank_code',
  user_id:    'user_id',
  pin:        'pin'
})

Now, you can receive your balances, accounts and transactions:

Receiving the transactions

iban = 'DE05740900000011111111'
start_date = 3.day.ago
end_date = Time.now

Hbci::Connector.open(credentials) do |connector|
  Hbci::Dialog.open(connector) do |dialog|
    transactions = Hbci::Services::TransactionsReceiver.new(connector, dialog, iban).perform(start_date, end_date)
    transactions.each do |transaction|
      puts transaction
    end
  end
end

Receiving a balance

iban = 'DE05740900000011111111'

Hbci::Connector.open(credentials) do |connector|
  Hbci::Dialog.open(connector) do |dialog|
    puts Hbci::Services::BalanceReceiver.new(connector, dialog, iban).perform
  end
end

Receiving the accounts

Hbci::Connector.open(credentials) do |connector|
  Hbci::Dialog.open(connector) do |dialog|
    accounts = Hbci::Services::AccountsReceiver.new(dialog).perform
    accounts.each do |account|
      puts account
    end
  end
end

Banks tested

Bank Tested HBCI URL
VR Bank DONE https://hbci11.fiducia.de/cgi-bin/hbciservlet
Postbank DONE https://hbci.postbank.de/banking/hbci.do
Consorsbank DONE https://brokerage-hbci.consorsbank.de/hbci
Hypovereinsbank OPEN https://hbci-01.hypovereinsbank.de/bank/hbci

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake rspec 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/fintastic/hbci

Hbci Documentation

License

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