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 (john@ward.name) 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

CARD_MAPPING =
{
  'master'            => 'MC',
  'visa'              => 'VISA',
  'american_express'  => 'AMEX',
  'diners_club'       => 'DINERS',
  'switch'            => 'SWITCH',
  'solo'              => 'SWITCH',
  'laser'             => 'LASER',
  'maestro'           => 'MC'
}
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, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

card_brand, #card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ RealexGateway



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

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



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

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



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

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

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



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

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

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



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

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



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

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

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



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

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