Class: ActiveMerchant::Billing::DecidirGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::DecidirGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/decidir.rb
Constant Summary
collapse
- STANDARD_ERROR_CODE_MAPPING =
{
1 => STANDARD_ERROR_CODE[:call_issuer],
2 => STANDARD_ERROR_CODE[:call_issuer],
3 => STANDARD_ERROR_CODE[:config_error],
4 => STANDARD_ERROR_CODE[:pickup_card],
5 => STANDARD_ERROR_CODE[:card_declined],
7 => STANDARD_ERROR_CODE[:pickup_card],
12 => STANDARD_ERROR_CODE[:processing_error],
14 => STANDARD_ERROR_CODE[:invalid_number],
28 => STANDARD_ERROR_CODE[:processing_error],
38 => STANDARD_ERROR_CODE[:incorrect_pin],
39 => STANDARD_ERROR_CODE[:invalid_number],
43 => STANDARD_ERROR_CODE[:pickup_card],
45 => STANDARD_ERROR_CODE[:card_declined],
46 => STANDARD_ERROR_CODE[:invalid_number],
47 => STANDARD_ERROR_CODE[:card_declined],
48 => STANDARD_ERROR_CODE[:card_declined],
49 => STANDARD_ERROR_CODE[:invalid_expiry_date],
51 => STANDARD_ERROR_CODE[:card_declined],
53 => STANDARD_ERROR_CODE[:card_declined],
54 => STANDARD_ERROR_CODE[:expired_card],
55 => STANDARD_ERROR_CODE[:incorrect_pin],
56 => STANDARD_ERROR_CODE[:card_declined],
57 => STANDARD_ERROR_CODE[:card_declined],
76 => STANDARD_ERROR_CODE[:call_issuer],
96 => STANDARD_ERROR_CODE[:processing_error],
97 => STANDARD_ERROR_CODE[:processing_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, payment, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ DecidirGateway
constructor
A new instance of DecidirGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ 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?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of DecidirGateway.
44
45
46
47
48
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 44
def initialize(options={})
requires!(options, :api_key)
super
@options[:preauth_mode] ||= false
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 58
def authorize(money, payment, options={})
raise ArgumentError, 'Authorize is not supported on Decidir gateways unless the preauth_mode option is enabled' unless @options[:preauth_mode]
post = {}
add_auth_purchase_params(post, money, payment, options)
commit(:post, 'payments', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
66
67
68
69
70
71
72
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 66
def capture(money, authorization, options={})
raise ArgumentError, 'Capture is not supported on Decidir gateways unless the preauth_mode option is enabled' unless @options[:preauth_mode]
post = {}
add_amount(post, money, options)
commit(:put, "payments/#{authorization}", post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 50
def purchase(money, payment, options={})
raise ArgumentError, 'Purchase is not supported on Decidir gateways configured with the preauth_mode option' if @options[:preauth_mode]
post = {}
add_auth_purchase_params(post, money, payment, options)
commit(:post, 'payments', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
74
75
76
77
78
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 74
def refund(money, authorization, options={})
post = {}
add_amount(post, money, options)
commit(:post, "payments/#{authorization}/refunds", post)
end
|
#scrub(transcript) ⇒ Object
98
99
100
101
102
103
104
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 98
def scrub(transcript)
transcript.
gsub(%r((apikey: )\w+)i, '\1[FILTERED]').
gsub(%r((\"card_number\\\":\\\")\d+), '\1[FILTERED]').
gsub(%r((\"security_code\\\":\\\")\d+), '\1[FILTERED]').
gsub(%r((\"emv_issuer_data\\\":\\\")\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
94
95
96
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 94
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
85
86
87
88
89
90
91
92
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 85
def verify(credit_card, options={})
raise ArgumentError, 'Verify is not supported on Decidir gateways unless the preauth_mode option is enabled' unless @options[:preauth_mode]
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
80
81
82
83
|
# File 'lib/active_merchant/billing/gateways/decidir.rb', line 80
def void(authorization, options={})
post = {}
commit(:post, "payments/#{authorization}/refunds", post)
end
|