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, authorization, 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
-
#void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#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
|
# 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.has_key?(:rebate_secret)
super
end
|
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
56
57
58
59
60
61
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 56
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
63
64
65
66
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 63
def capture(money, authorization, options = {})
request = build_capture_request(money, authorization, options)
commit(request)
end
|
#credit(money, authorization, options = {}) ⇒ Object
#purchase(money, credit_card, options = {}) ⇒ Object
49
50
51
52
53
54
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 49
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
68
69
70
71
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 68
def refund(money, authorization, options = {})
request = build_refund_request(money, authorization, options)
commit(request)
end
|
#scrub(transcript) ⇒ Object
87
88
89
90
91
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 87
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r((<number>)\d+(</number>))i, '\1[FILTERED]\2')
end
|
#supports_scrubbing ⇒ Object
83
84
85
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 83
def supports_scrubbing
true
end
|
#void(authorization, options = {}) ⇒ Object
78
79
80
81
|
# File 'lib/active_merchant/billing/gateways/realex.rb', line 78
def void(authorization, options = {})
request = build_void_request(authorization, options)
commit(request)
end
|