Implements iPizza protocol to communicate with Estonian Banks.
Gem implements support for iPizza services (1011
, 1012
, 4011
and 4012
) that are supported by members of the Estonian Banking Association since October 2014.
If you need to use this gem with old iPizza services implementations (1001
, 1002
, 4001
and 4002
), use 1.0.0 version of this gem (NB! support for these services will end on 31 December 2015).
Add gem dependency in your Gemfile
and install the gem:
gem 'ipizza'
Since ipizza gem version 1.0.0, Ruby 1.8 support has been dropped. If you need to use this gem with older versions of Ruby, use 0.7.1 version of this gem.
Configuration can be made in two different ways, using Ipizza::Config.configure
block or loading configuration properties from YAML file.
Loading from YAML file:
Ipizza::Config.load_from_file('config.yml')
Configuration values should be set in YAML file in provider.attribute_value format. See example YAML file below in "Configuration parameters" section.
At any time, configuration can be modified with Ipizza::Config.configure
block:
Ipizza::Config.configure do |c|
c.certs_root = '/path/to/certificates'
c.swedbank_service_url = 'https://foo.bar/swedbank'
end
swedbank:
service_url: https://foo.bar/swedbank
return_url: https://mycompany.com/store
cancel_url: https://mycompany.com/cancel
# Your private key file path. Can be specified relatively
# to YAML file
file_key: ./certificates/my_private.key
# If your private key is protected with password,
# provide it here
key_secret: private_key_password
# Path to bank's public key file. Can be specified
# relatively to YAML file
file_cert: ./certificates/bank_public.crt
snd_id: dealer
encoding: UTF-8
payment = Ipizza::Payment.new(
:stamp => 1, :amount => '123.34', :refnum => 1,
:message => 'Payment message', :currency => 'EUR'
)
request = Ipizza::Provider::Swedbank.new.payment_request(@payment)
request = Ipizza::Provider::Swedbank.new.authentication_request
response = Ipizza::Provider::Swedbank.new.authentication_response({'VK_PARAM_1' => 'VALUE 1', ...})
response.valid?
This library currently works with four Estonian Banks. Here are their respective interface specifications:
- Swedbank
- SEB
- Danske Bank
- Krediidipank
- LHV Bank
- Nordea (uses SOLO protocol)
- Thanks to all contributors!
- Tarmo Talu (Thanks for the 7-3-1 algorithm)