Class: ActiveMerchant::Billing::RealexGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/realex.rb

Overview

Realex is the leading CC gateway in Ireland see www.realexpayments.com Contributed by John Ward ([email protected]) see thinedgeofthewedge.blogspot.com

Realex works using the following login - The unique id of the merchant password - The secret is used to digitally sign the request account - This is an optional third part of the authentication process and is used if the merchant wishes do distinguish cc traffic from the different sources by using a different account. This must be created in advance

the Realex team decided to make the orderid unique per request, so if validation fails you can not correct and resend using the same order id

Constant Summary collapse

CARD_MAPPING =
{
  'master'            => 'MC',
  'visa'              => 'VISA',
  'american_express'  => 'AMEX',
  'diners_club'       => 'DINERS',
  'switch'            => 'SWITCH',
  'solo'              => 'SWITCH',
  'laser'             => 'LASER'
}
BANK_ERROR =
REALEX_ERROR  = "Gateway is in maintenance. Please try again later."
ERROR =
CLIENT_DEACTIVATED = "Gateway Error"

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ RealexGateway

Returns a new instance of RealexGateway.



45
46
47
48
49
# File 'lib/active_merchant/billing/gateways/realex.rb', line 45

def initialize(options = {})
  requires!(options, :login, :password)
  options[:refund_hash] = Digest::SHA1.hexdigest(options[:rebate_secret]) if options.has_key?(:rebate_secret)
  super
end

Instance Method Details

#authorize(money, creditcard, options = {}) ⇒ Object



58
59
60
61
62
63
# File 'lib/active_merchant/billing/gateways/realex.rb', line 58

def authorize(money, creditcard, options = {})
  requires!(options, :order_id)

  request = build_purchase_or_authorization_request(:authorization, money, creditcard, options)
  commit(request)
end

#capture(money, authorization, options = {}) ⇒ Object



65
66
67
68
# File 'lib/active_merchant/billing/gateways/realex.rb', line 65

def capture(money, authorization, options = {})
  request = build_capture_request(authorization, options)
  commit(request)
end

#credit(money, authorization, options = {}) ⇒ Object



75
76
77
78
# File 'lib/active_merchant/billing/gateways/realex.rb', line 75

def credit(money, authorization, options = {})
  deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, authorization, options)
end

#purchase(money, credit_card, options = {}) ⇒ Object



51
52
53
54
55
56
# File 'lib/active_merchant/billing/gateways/realex.rb', line 51

def purchase(money, credit_card, options = {})
  requires!(options, :order_id)

  request = build_purchase_or_authorization_request(:purchase, money, credit_card, options)
  commit(request)
end

#refund(money, authorization, options = {}) ⇒ Object



70
71
72
73
# File 'lib/active_merchant/billing/gateways/realex.rb', line 70

def refund(money, authorization, options = {})
  request = build_refund_request(money, authorization, options)
  commit(request)
end

#void(authorization, options = {}) ⇒ Object



80
81
82
83
# File 'lib/active_merchant/billing/gateways/realex.rb', line 80

def void(authorization, options = {})
  request = build_void_request(authorization, options)
  commit(request)
end