Active Merchant

Original active merchant project without the Estonian bank links support can be found here

Banklink implementations for the following Estonian banks:

Notes

  • SEB works fine (UTF-8).

  • Swedbank works fine (ISO-8859-1). The documentation says it should support UTF-8 too, but I wasn’t able to get it work.

  • Sampo Pank is not tested yet. Any feedback would be appreciated, should you test it.

Download

Currently this library is available with git from:

git://github.com/innu/active_merchant.git

Installation

Rails 2.*

Add activemerchant-est to your config/environment.rb and install it

config.gem "activemerchant-est", :lib => "active_merchant", :source => "http://gemcutter.org"
> rake gems:install

Rails 3

Add activemerchant-est to your Gemfile and install it

gem "activemerchant-est", :require_as => "active_merchant"
> gem bundle

Sample Usage

SEB

Configuration:

ActiveMerchant::Billing::Integrations::SebEst.bank_certificate = File.read("cert")
ActiveMerchant::Billing::Integrations::SebEst.private_key = File.read("keyfile")
ActiveMerchant::Billing::Integrations::SebEst.production_url = "https://www.seb.ee/cgi-bin/unet3.sh/un3min.r"

The syntax of the helper

  • The order_id parameter is a random id referencing the transaction (VK_STAMP)

  • The account_id parameter is a id given to you from the bank (VK_SND_ID)

  • The notify_url is the URL that the bank will send its responses.

    <% payment_service_for order_id, account_id,
      :amount => 50.00,
      :service => :seb_est do |service| %>
    
      <% service.notify_url url_for(:action => "notify", :only_path => false) %>
      <% service.cancel_return_url "http://mystore.com" %>
    <% end %>
    

You can handle the notification in your controller action as follows:

class NotificationController < ApplicationController
  include ActiveMerchant::Billing::Integrations

  def notify
    # Notification class is automatically fetched based on the request parameters.
    notify = Pizza::Notification.get_notification(params)

    if notify.acknowledge
      ... process order ... if notify.complete?
    else
      ... log possible hacking attempt ...
    end
  end
end

Swedbank

Configuration:

ActiveMerchant::Billing::Integrations::SwedbankEst.bank_certificate = File.read("cert")
ActiveMerchant::Billing::Integrations::SwedbankEst.private_key = File.read("keyfile")
ActiveMerchant::Billing::Integrations::SwedbankEst.production_url = "https://www.swedbank.ee/banklink"

The syntax of the helper

  • The order_id parameter is a random id referencing the transaction (VK_STAMP)

  • The account_id parameter is a id given to you from the bank (VK_SND_ID)

  • The notify_url is the URL that the bank will send its responses.

    <% payment_service_for order_id, account_id,
      :amount => 50.00,
      :service => :swedbank_est do |service| %>
    
      <% service.notify_url url_for(:action => "notify", :only_path => false) %>
      <% service.cancel_return_url "http://mystore.com" %>
    <% end %>
    

Sampo Pank

Configuration:

ActiveMerchant::Billing::Integrations::SampoEst.bank_certificate = File.read("cert")
ActiveMerchant::Billing::Integrations::SampoEst.private_key = File.read("keyfile")
ActiveMerchant::Billing::Integrations::SampoEst.production_url = ""

The syntax of the helper

  • The order_id parameter is a random id referencing the transaction (VK_STAMP)

  • The account_id parameter is a id given to you from the bank (VK_SND_ID)

  • The notify_url is the URL that the bank will send its responses.

    <% payment_service_for order_id, account_id,
      :amount => 50.00,
      :service => :sampo_est do |service| %>
    
      <% service.notify_url url_for(:action => "notify", :only_path => false) %>
      <% service.cancel_return_url "http://mystore.com" %>
    <% end %>