public
Description: A plugin for ActiveMerchant to have Ogone support
Homepage:
Clone URL: git://github.com/DefV/active_merchant_ogone.git
simonmenke (author)
Fri Oct 02 05:43:11 -0700 2009
DefV (committer)
Fri Oct 02 05:54:07 -0700 2009
commit  164535ee224a843bc7b3bd157dd40a5b7b41c65d
tree    4a02affb2adf039bdf12ff823c12cfa95fd5edd6
parent  4d13be3515bf849f7e1946a2333d91a0ddb481fd
README.rdoc

ActiveMerchantOgone

A plugin for Ogone support in ActiveRecord.

Installation

Requirements

First you need the ActiveMerchant gem / rails-plugin installed. More info about ActiveMerchant installation can be found at activemerchant.rubyforge.org/.

As a Rails plugin

To install ActiveMerchantOgone in your rails app you can just do:

  > ./script/plugin install git://github.com/DefV/active_merchant_ogone.git

As a gem

To install ActiveMerchantOgone in your rails app you can just do:

  config.gem 'simonmenke-active_merchant_ogone', :lib => 'active_merchant_ogone', :source => 'http://gems.github.com'

Configuration

As Ogone works with in and out signatures, you will have to set these as constants in your configuration file.

  OGONE_ACCOUNT = 'account_name'
  Ogone.setup do |c|
    c.outbound_signature = '094598439859385938958398494' # Item 3.2 of the technical information
    c.inbound_signature  = '094598439859385938958398494' # Item 4.4 of the technical information
  end

Example Usage

Once you’ve configured the Ogone settings you need to set up a leaving page with in your view:

  <% payment_service_for @order.ogone_id, OGONE_ACCOUNT,
      :amount   => @order.price * 100 # needs to be in cents
      :currency   => 'EUR',
      :service  => :ogone do |service| %>

    <%  service.redirect :accepturl => checkout_url(@order),
               :cancelurl => checkout_url(@order),
               :declineurl => checkout_url(@order),
               :exceptionurl => checkout_url(@order) %>

    <%= submit_tag "Pay with Ogone!" %>
  <% end %>

And in your controller you should have an enter path:

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

    def show
      @notification = Ogone::Notification.new(request.query_string)

      @order = Order.find_by_ogone_id(@notification.order_id)
      if @notification.complete?
        @order.paid!
      else
        @order.failed!
      end
    end
  end

Copyright © 2009 Openminds BVBVA, released under the MIT license