Helper gem to simplify bank link usage in Rails projects
Add this line to your application's Gemfile:
gem 'bank_link'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bank_link
BankLink.configuration do |config|
BankLink do |config|
Defaults can be found in mac_fields.yml
config.mac_fields do |mac_fields|
mac_fields.SOLOPMT_VERSION[:request]["0003"] = [
:VERSION,
:STAMP,
:RCV_ID,
:AMOUNT,
:REF,
:DATE,
:CUR
]
end
config.banks :name_of_bank do |bank|
bank.settings do |settings|
settings.encoding_key = "VK_CHARSET"
settings.encoding = "UTF-8"
settings.private_key = File.read("my/private_key.pem")
settings.private_key_passphrase = File.read("my_password")
settings.public_key = File.read("bank/certificate")
settings.mac_class = BankLink::Mac::VK
settings.digest = OpenSSL::Digest::SHA1
settings.mac_class = BankLink::Mac::Solo
settings.digest = OpenSSL::Digest::MD5
settings.mac_class = BankLink::Mac::Custom #Or roll your own
end
All the correct form fields can be found in various bank documentations, listed below. "Have fun"
bank.payment_link "https://url.of.link" do |form|
form[:VK_SERVICE] = "1001"
form[:VK_VERSION] = "008"
form[:VK_AMOUNT] = Proc.new { |link, object| object.price }
form[:VK_CURR] = "EUR"
end
bank.authorization_link "https://url.of.link/auth" do |form|
form[:VK_SERVICE] = "1001"
form[:VK_VERSION] = "008"
end
= payment_links @object do |link|
= submit_tag(link.bank.name)
- BankLink.payment_links do |link|
= bank_link_tag link, @object do
= submit_tag(link.bank.name)
- payment_links @object, { :values => { :VK_AMOUNT => Proc.new { |link, object| object.price * 2 } }} do |link|
= submit_tag
- BankLink.payment_links do |link|
= bank_link_tag link, @object, { :values => {:VK_AMOUNT => @object.price }} do
= submit_tag
- payment_links @object, { :form => { :data => { :something => "other" } } } do |link|
= submit_tag
- BankLink.payment_links do |link|
= bank_link_tag link, @object, { :form => {:method => :get }} do
= submit_tag
link = BankLink.configuration.banks.name_of_link
link.verify params
- Danske Bank Documentation
- Krediidipank Documentation
- LHV Documentation
- Nordea Documentation
- SEB Documentation
- Swedbank Documentation
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request