Class: ActiveMerchant::Billing::OgoneGateway
- Defined in:
- lib/active_merchant/billing/gateways/ogone.rb
Overview
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 2.4 (December 2008), 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 2.2 available here: secure.ogone.com/ncol/Ogone_Alias_EN.pdf
It was last tested on Release 04.79 of Ogone e-Commerce (dated 11/02/2009).
For any questions or comments, please contact Nicolas Jacobeus ([email protected]).
Example use:
gateway = ActiveMerchant::Billing::OgoneGateway.new(
:login => "my_ogone_psp_id",
:user => "my_ogone_user_id",
:password => "my_ogone_pswd",
:signature => "my_ogone_sha1_signature" # extra security, only if you configured your Ogone environment so
)
# set up credit card obj 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
To use the alias feature, simply add :alias in the options hash:
gateway.purchase(1000, creditcard, :order_id => "1", :alias => "myawesomecustomer") # associates the alias to that creditcard
gateway.purchase(2000, nil, :order_id => "2", :alias => "myawesomecustomer") # don't need to know the creditcard for subsequent orders
Constant Summary collapse
- URLS =
{ :test => { :order => 'https://secure.ogone.com/ncol/test/orderdirect.asp', :maintenance => 'https://secure.ogone.com/ncol/test/maintenancedirect.asp' }, :production => { :order => 'https://secure.ogone.com/ncol/prod/orderdirect.asp', :maintenance => 'https://secure.ogone.com/ncol/prod/maintenancedirect.asp' } }
- CVV_MAPPING =
{ 'OK' => 'M', 'KO' => 'N', 'NO' => 'P' }
- AVS_MAPPING =
{ 'OK' => 'M', 'KO' => 'N', 'NO' => 'R' }
- SUCCESS_MESSAGE =
"The transaction was successful"
Constants inherited from Gateway
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, payment_source, options = {}) ⇒ Object
Verify and reserve the specified amount on the account, without actually doing the transaction.
-
#capture(money, authorization, options = {}) ⇒ Object
Complete a previously authorized transaction.
-
#credit(money, identification_or_credit_card, options = {}) ⇒ Object
Credit the specified account by a specific amount.
-
#initialize(options = {}) ⇒ OgoneGateway
constructor
A new instance of OgoneGateway.
-
#purchase(money, payment_source, options = {}) ⇒ Object
Verify and transfer the specified amount.
- #test? ⇒ Boolean
-
#void(identification, options = {}) ⇒ Object
Cancels a previously authorized transaction.
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?
Methods included from Utils
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
#initialize(options = {}) ⇒ OgoneGateway
Returns a new instance of OgoneGateway.
81 82 83 84 85 |
# File 'lib/active_merchant/billing/gateways/ogone.rb', line 81 def initialize( = {}) requires!(, :login, :user, :password) @options = super end |
Instance Method Details
#authorize(money, payment_source, options = {}) ⇒ Object
Verify and reserve the specified amount on the account, without actually doing the transaction.
88 89 90 91 92 93 94 95 96 |
# File 'lib/active_merchant/billing/gateways/ogone.rb', line 88 def (money, payment_source, = {}) post = {} add_invoice(post, ) add_payment_source(post, payment_source, ) add_address(post, payment_source, ) add_customer_data(post, ) add_money(post, money, ) commit('RES', post) end |
#capture(money, authorization, options = {}) ⇒ Object
Complete a previously authorized transaction.
110 111 112 113 114 115 116 117 |
# File 'lib/active_merchant/billing/gateways/ogone.rb', line 110 def capture(money, , = {}) post = {} (post, reference_from()) add_invoice(post, ) add_customer_data(post, ) add_money(post, money, ) commit('SAL', post) end |
#credit(money, identification_or_credit_card, options = {}) ⇒ Object
Credit the specified account by a specific amount.
127 128 129 130 131 132 133 134 |
# File 'lib/active_merchant/billing/gateways/ogone.rb', line 127 def credit(money, identification_or_credit_card, = {}) if reference_transaction?(identification_or_credit_card) # Referenced credit: refund of a settled transaction perform_reference_credit(money, identification_or_credit_card, ) else # must be a credit card or card reference perform_non_referenced_credit(money, identification_or_credit_card, ) end end |
#purchase(money, payment_source, options = {}) ⇒ Object
Verify and transfer the specified amount.
99 100 101 102 103 104 105 106 107 |
# File 'lib/active_merchant/billing/gateways/ogone.rb', line 99 def purchase(money, payment_source, = {}) post = {} add_invoice(post, ) add_payment_source(post, payment_source, ) add_address(post, payment_source, ) add_customer_data(post, ) add_money(post, money, ) commit('SAL', post) end |
#test? ⇒ Boolean
136 137 138 |
# File 'lib/active_merchant/billing/gateways/ogone.rb', line 136 def test? @options[:test] || super end |
#void(identification, options = {}) ⇒ Object
Cancels a previously authorized transaction.
120 121 122 123 124 |
# File 'lib/active_merchant/billing/gateways/ogone.rb', line 120 def void(identification, = {}) post = {} (post, reference_from(identification)) commit('DES', post) end |