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]
}
- SCHEDULED_PAYMENT_TYPES =
%w(recurring installment)
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 = {}) ⇒ 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
-
#store(payment, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#unstore(authorization, options = {}) ⇒ 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?, #test?
#format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of CardConnectGateway.
66
67
68
69
70
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 66
def initialize(options = {})
requires!(options, :merchant_id, :username, :password)
require_valid_domain!(options, :domain)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 100
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_three_ds_mpi_data(post, options)
add_additional_data(post, options)
add_stored_credential(post, options)
commit('auth', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
114
115
116
117
118
119
120
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 114
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 78
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_three_ds_mpi_data(post, options)
add_additional_data(post, options)
add_stored_credential(post, options)
post[:capture] = 'Y'
commit('auth', post)
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
122
123
124
125
126
127
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 122
def refund(money, authorization, options = {})
post = {}
add_money(post, money)
add_reference(post, authorization)
commit('refund', post)
end
|
#require_valid_domain!(options, param) ⇒ Object
72
73
74
75
76
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 72
def require_valid_domain!(options, param)
if options[param]
raise ArgumentError.new('not a valid cardconnect domain') unless /https:\/\/\D*cardconnect.com/ =~ options[param]
end
end
|
#scrub(transcript) ⇒ Object
158
159
160
161
162
163
164
165
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 158
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
|
#store(payment, options = {}) ⇒ Object
139
140
141
142
143
144
145
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 139
def store(payment, options = {})
post = {}
add_payment(post, payment)
add_address(post, options)
add_customer_data(post, options)
commit('profile', post)
end
|
#supports_scrubbing? ⇒ Boolean
154
155
156
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 154
def supports_scrubbing?
true
end
|
#unstore(authorization, options = {}) ⇒ Object
147
148
149
150
151
152
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 147
def unstore(authorization, options = {})
account_id, profile_id = authorization.split('|')
commit('profile', {},
verb: :delete,
path: "/#{profile_id}/#{account_id}/#{@options[:merchant_id]}")
end
|
#verify(credit_card, options = {}) ⇒ Object
135
136
137
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 135
def verify(credit_card, options = {})
authorize(0, credit_card, options)
end
|
#void(authorization, options = {}) ⇒ Object
129
130
131
132
133
|
# File 'lib/active_merchant/billing/gateways/card_connect.rb', line 129
def void(authorization, options = {})
post = {}
add_reference(post, authorization)
commit('void', post)
end
|