Class: ActiveMerchant::Billing::RealexGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::RealexGateway
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',
'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::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(money, creditcard, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#credit(money, creditcard, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ RealexGateway
constructor
A new instance of RealexGateway.
-
#purchase(money, credit_card, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing ⇒ Object
-
#verify(credit_card, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ RealexGateway
Returns a new instance of RealexGateway.
43
44
45
46
47
48
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 43
def initialize(options = {})
requires!(options, :login, :password)
options[:refund_hash] = Digest::SHA1.hexdigest(options[:rebate_secret]) if options[:rebate_secret].present?
options[:credit_hash] = Digest::SHA1.hexdigest(options[:refund_secret]) if options[:refund_secret].present?
super
end
|
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 57
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
64
65
66
67
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 64
def capture(money, authorization, options = {})
request = build_capture_request(money, authorization, options)
commit(request)
end
|
#credit(money, creditcard, options = {}) ⇒ Object
74
75
76
77
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 74
def credit(money, creditcard, options = {})
request = build_credit_request(money, creditcard, options)
commit(request)
end
|
#purchase(money, credit_card, options = {}) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 50
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
69
70
71
72
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 69
def refund(money, authorization, options = {})
request = build_refund_request(money, authorization, options)
commit(request)
end
|
#scrub(transcript) ⇒ Object
95
96
97
98
99
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 95
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r((<number>)\d+(</number>))i, '\1[FILTERED]\2')
end
|
#supports_scrubbing ⇒ Object
91
92
93
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 91
def supports_scrubbing
true
end
|
#verify(credit_card, options = {}) ⇒ Object
84
85
86
87
88
89
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 84
def verify(credit_card, options = {})
requires!(options, :order_id)
request = build_verify_request(credit_card, options)
commit(request)
end
|
#void(authorization, options = {}) ⇒ Object
79
80
81
82
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 79
def void(authorization, options = {})
request = build_void_request(authorization, options)
commit(request)
end
|