Class: ActiveMerchant::Billing::CardConnectGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::CardConnectGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/card_connect.rb
Constant Summary
collapse
- STANDARD_ERROR_CODE_MAPPING =
{
'11' => STANDARD_ERROR_CODE[:card_declined],
'12' => STANDARD_ERROR_CODE[:incorrect_number],
'13' => STANDARD_ERROR_CODE[:incorrect_cvc],
'14' => STANDARD_ERROR_CODE[:incorrect_cvc],
'15' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'16' => STANDARD_ERROR_CODE[:expired_card],
'17' => STANDARD_ERROR_CODE[:incorrect_zip],
'21' => STANDARD_ERROR_CODE[:config_error],
'22' => STANDARD_ERROR_CODE[:config_error],
'23' => STANDARD_ERROR_CODE[:config_error],
'24' => STANDARD_ERROR_CODE[:processing_error],
'25' => STANDARD_ERROR_CODE[:processing_error],
'27' => STANDARD_ERROR_CODE[:processing_error],
'28' => STANDARD_ERROR_CODE[:processing_error],
'29' => STANDARD_ERROR_CODE[:processing_error],
'31' => STANDARD_ERROR_CODE[:processing_error],
'32' => STANDARD_ERROR_CODE[:processing_error],
'33' => STANDARD_ERROR_CODE[:card_declined],
'34' => STANDARD_ERROR_CODE[:card_declined],
'35' => STANDARD_ERROR_CODE[:incorrect_zip],
'36' => STANDARD_ERROR_CODE[:processing_error],
'37' => STANDARD_ERROR_CODE[:incorrect_cvc],
'41' => STANDARD_ERROR_CODE[:processing_error],
'42' => STANDARD_ERROR_CODE[:processing_error],
'43' => STANDARD_ERROR_CODE[:processing_error],
'44' => STANDARD_ERROR_CODE[:config_error],
'61' => STANDARD_ERROR_CODE[:processing_error],
'62' => STANDARD_ERROR_CODE[:processing_error],
'63' => STANDARD_ERROR_CODE[:processing_error],
'64' => STANDARD_ERROR_CODE[:config_error],
'65' => STANDARD_ERROR_CODE[:processing_error],
'66' => STANDARD_ERROR_CODE[:processing_error],
'91' => STANDARD_ERROR_CODE[:processing_error],
'92' => STANDARD_ERROR_CODE[:processing_error],
'93' => STANDARD_ERROR_CODE[:processing_error],
'94' => STANDARD_ERROR_CODE[:processing_error],
'95' => STANDARD_ERROR_CODE[:config_error],
'96' => STANDARD_ERROR_CODE[:processing_error],
'NU' => STANDARD_ERROR_CODE[:card_declined],
'N3' => STANDARD_ERROR_CODE[:card_declined],
'NJ' => STANDARD_ERROR_CODE[:card_declined],
'51' => STANDARD_ERROR_CODE[:card_declined],
'C2' => STANDARD_ERROR_CODE[:incorrect_cvc],
'54' => STANDARD_ERROR_CODE[:expired_card],
'05' => STANDARD_ERROR_CODE[:card_declined],
'03' => STANDARD_ERROR_CODE[:config_error],
'60' => STANDARD_ERROR_CODE[:pickup_card]
}
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::DEBIT_CARDS, 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 = {}) ⇒ CardConnectGateway
constructor
A new instance of CardConnectGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#require_valid_domain!(options, param) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(credit_card, options = {}) ⇒ 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?, #test?
#format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of CardConnectGateway.
64
65
66
67
68
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 64
def initialize(options = {})
requires!(options, :merchant_id, :username, :password)
require_valid_domain!(options, :domain)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 96
def authorize(money, payment, options = {})
post = {}
add_money(post, money)
add_currency(post, money, options)
add_invoice(post, options)
add_payment(post, payment)
add_address(post, options)
add_customer_data(post, options)
add_3DS(post, options)
commit('auth', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
108
109
110
111
112
113
114
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 108
def capture(money, authorization, options = {})
post = {}
add_money(post, money)
add_reference(post, authorization)
add_additional_data(post, options)
commit('capture', post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 76
def purchase(money, payment, options = {})
if options[:po_number]
MultiResponse.run do |r|
r.process { authorize(money, payment, options) }
r.process { capture(money, r.authorization, options) }
end
else
post = {}
add_invoice(post, options)
add_money(post, money)
add_payment(post, payment)
add_currency(post, money, options)
add_address(post, options)
add_customer_data(post, options)
add_3DS(post, options)
post[:capture] = 'Y'
commit('auth', post)
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
116
117
118
119
120
121
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 116
def refund(money, authorization, options = {})
post = {}
add_money(post, money)
add_reference(post, authorization)
commit('refund', post)
end
|
#require_valid_domain!(options, param) ⇒ Object
70
71
72
73
74
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 70
def require_valid_domain!(options, param)
if options.key?(param)
raise ArgumentError.new('not a valid cardconnect domain') unless /\Dcardconnect.com:\d{1,}\D/ =~ options[param]
end
end
|
#scrub(transcript) ⇒ Object
137
138
139
140
141
142
143
144
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 137
def scrub(transcript)
transcript
.gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]')
.gsub(%r(("cvv2\\":\\")\d*), '\1[FILTERED]')
.gsub(%r(("merchid\\":\\")\d*), '\1[FILTERED]')
.gsub(%r((&?"account\\":\\")\d*), '\1[FILTERED]')
.gsub(%r((&?"token\\":\\")\d*), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
133
134
135
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 133
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
129
130
131
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 129
def verify(credit_card, options = {})
authorize(0, credit_card, options)
end
|
#void(authorization, options = {}) ⇒ Object
123
124
125
126
127
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 123
def void(authorization, options = {})
post = {}
add_reference(post, authorization)
commit('void', post)
end
|