Class: ActiveMerchant::Billing::SecurionPayGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::SecurionPayGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/securion_pay.rb
Constant Summary
collapse
- STANDARD_ERROR_CODE_MAPPING =
{
'incorrect_number' => STANDARD_ERROR_CODE[:incorrect_number],
'invalid_number' => STANDARD_ERROR_CODE[:invalid_number],
'invalid_expiry_month' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'invalid_expiry_year' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'invalid_cvc' => STANDARD_ERROR_CODE[:invalid_cvc],
'expired_card' => STANDARD_ERROR_CODE[:expired_card],
'insufficient_funds' => STANDARD_ERROR_CODE[:card_declined],
'incorrect_cvc' => STANDARD_ERROR_CODE[:incorrect_cvc],
'incorrect_zip' => STANDARD_ERROR_CODE[:incorrect_zip],
'card_declined' => STANDARD_ERROR_CODE[:card_declined],
'processing_error' => STANDARD_ERROR_CODE[:processing_error],
'lost_or_stolen' => STANDARD_ERROR_CODE[:card_declined],
'suspected_fraud' => STANDARD_ERROR_CODE[:card_declined],
'expired_token' => STANDARD_ERROR_CODE[:card_declined]
}
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, payment, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#customer(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ SecurionPayGateway
constructor
A new instance of SecurionPayGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#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?
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of SecurionPayGateway.
34
35
36
37
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 34
def initialize(options = {})
requires!(options, :secret_key)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
44
45
46
47
48
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 44
def authorize(money, payment, options = {})
post = create_post_for_auth_or_purchase(money, payment, options)
post[:captured] = 'false'
commit('charges', post, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
50
51
52
53
54
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 50
def capture(money, authorization, options = {})
post = {}
add_amount(post, money, options)
commit("charges/#{CGI.escape(authorization)}/capture", post, options)
end
|
#customer(options = {}) ⇒ Object
88
89
90
91
92
93
94
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 88
def customer(options = {})
if options[:customer_id].blank?
return nil
else
commit("customers/#{CGI.escape(options[:customer_id])}", nil, options, :get)
end
end
|
#purchase(money, payment, options = {}) ⇒ Object
39
40
41
42
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 39
def purchase(money, payment, options = {})
post = create_post_for_auth_or_purchase(money, payment, options)
commit('charges', post, options)
end
|
#refund(money, authorization, options = {}) ⇒ Object
56
57
58
59
60
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 56
def refund(money, authorization, options = {})
post = {}
add_amount(post, money, options)
commit("charges/#{CGI.escape(authorization)}/refund", post, options)
end
|
#scrub(transcript) ⇒ Object
100
101
102
103
104
105
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 100
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r((card\[number\]=)\d+), '\1[FILTERED]').
gsub(%r((card\[cvc\]=)\d+), '\1[FILTERED]')
end
|
#store(credit_card, options = {}) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 73
def store(credit_card, options = {})
if options[:customer_id].blank?
MultiResponse.run() do |r|
r.process { authorize(100, credit_card, options) }
r.process { create_customer_add_card(r.authorization, options) }
r.process(:ignore_result) { void(r.params['metadata']['chargeId'], options) }
end
else
verify(credit_card, options)
end
end
|
#supports_scrubbing? ⇒ Boolean
96
97
98
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 96
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
66
67
68
69
70
71
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 66
def verify(credit_card, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
62
63
64
|
# File 'lib/active_merchant/billing/gateways/securion_pay.rb', line 62
def void(authorization, options = {})
commit("charges/#{CGI.escape(authorization)}/refund", {}, options)
end
|