Class/Module Index [+]

Quicksearch

ActiveMerchant::Billing::OgoneGateway

Ogone DirectLink Gateway

DirectLink is the API version of the Ogone Payment Platform. It allows server to server communication between Ogone systems and your e-commerce website.

This implementation follows the specification provided in the DirectLink integration guide version 4.2.0 (26 October 2011), available here: secure.ogone.com/ncol/Ogone_DirectLink_EN.pdf

It also features aliases, which allow to store/unstore credit cards, as specified in the Alias Manager Option guide version 3.2.0 (26 October 2011) available here: secure.ogone.com/ncol/Ogone_Alias_EN.pdf

It was last tested on Release 4.89 of Ogone DirectLink + AliasManager (26 October 2011).

For any questions or comments, please contact one of the following:

Usage

gateway = ActiveMerchant::Billing::OgoneGateway.new(
            :login                     => "my_ogone_psp_id",
            :user                      => "my_ogone_user_id",
            :password                  => "my_ogone_pswd",
            :signature                 => "my_ogone_sha_signature", # Only if you configured your Ogone environment so.
            :signature_encryptor       => "sha512", # Can be "sha1" (default), "sha256" or "sha512".
                                                    # Must be the same as the one configured in your Ogone account.
         )

# set up credit card object as in main ActiveMerchant example
creditcard = ActiveMerchant::Billing::CreditCard.new(
  :type       => 'visa',
  :number     => '4242424242424242',
  :month      => 8,
  :year       => 2009,
  :first_name => 'Bob',
  :last_name  => 'Bobsen'
)

# run request
response = gateway.purchase(1000, creditcard, :order_id => "1") # charge 10 EUR

If you don't provide an :order_id, the gateway will generate a random one for you.

puts response.success?      # Check whether the transaction was successful
puts response.message       # Retrieve the message returned by Ogone
puts response.authorization # Retrieve the unique transaction ID returned by Ogone

Alias feature

To use the alias feature, simply add :store in the options hash:

# Associate the alias to that credit card
gateway.purchase(1000, creditcard, :order_id => "1", :store => "myawesomecustomer")

# You can use the alias instead of the credit card for subsequent orders
gateway.purchase(2000, "myawesomecustomer", :order_id => "2")

Public Class Methods

new(options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/ogone.rb, line 93
def initialize(options = {})
  requires!(options, :login, :user, :password)
  @options = options
  super
end

Public Instance Methods

authorize(money, payment_source, options = {}) click to toggle source

Verify and reserve the specified amount on the account, without actually doing the transaction.

# File lib/active_merchant/billing/gateways/ogone.rb, line 100
def authorize(money, payment_source, options = {})
  post = {}
  add_invoice(post, options)
  add_payment_source(post, payment_source, options)
  add_address(post, payment_source, options)
  add_customer_data(post, options)
  add_money(post, money, options)
  commit('RES', post)
end
capture(money, authorization, options = {}) click to toggle source

Complete a previously authorized transaction.

# File lib/active_merchant/billing/gateways/ogone.rb, line 122
def capture(money, authorization, options = {})
  post = {}
  add_authorization(post, reference_from(authorization))
  add_invoice(post, options)
  add_customer_data(post, options)
  add_money(post, money, options)
  commit('SAL', post)
end
credit(money, identification_or_credit_card, options = {}) click to toggle source

Credit the specified account by a specific amount.

# File lib/active_merchant/billing/gateways/ogone.rb, line 139
def credit(money, identification_or_credit_card, options = {})
  if reference_transaction?(identification_or_credit_card)
    deprecated CREDIT_DEPRECATION_MESSAGE
    # Referenced credit: refund of a settled transaction
    refund(money, identification_or_credit_card, options)
  else # must be a credit card or card reference
    perform_non_referenced_credit(money, identification_or_credit_card, options)
  end
end
purchase(money, payment_source, options = {}) click to toggle source

Verify and transfer the specified amount.

# File lib/active_merchant/billing/gateways/ogone.rb, line 111
def purchase(money, payment_source, options = {})
  post = {}
  add_invoice(post, options)
  add_payment_source(post, payment_source, options)
  add_address(post, payment_source, options)
  add_customer_data(post, options)
  add_money(post, money, options)
  commit('SAL', post)
end
refund(money, reference, options = {}) click to toggle source

Refund of a settled transaction

# File lib/active_merchant/billing/gateways/ogone.rb, line 150
def refund(money, reference, options = {})
  perform_reference_credit(money, reference, options)
end
test?() click to toggle source
# File lib/active_merchant/billing/gateways/ogone.rb, line 154
def test?
  @options[:test] || super
end
void(identification, options = {}) click to toggle source

Cancels a previously authorized transaction.

# File lib/active_merchant/billing/gateways/ogone.rb, line 132
def void(identification, options = {})
  post = {}
  add_authorization(post, reference_from(identification))
  commit('DES', post)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.