Class: ActiveMerchant::Billing::CamsGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::CamsGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/cams.rb
Constant Summary
collapse
- STANDARD_ERROR_CODE_MAPPING =
{
'200' => STANDARD_ERROR_CODE[:card_declined],
'201' => STANDARD_ERROR_CODE[:card_declined],
'202' => STANDARD_ERROR_CODE[:card_declined],
'203' => STANDARD_ERROR_CODE[:card_declined],
'204' => STANDARD_ERROR_CODE[:card_declined],
'220' => STANDARD_ERROR_CODE[:card_declined],
'221' => STANDARD_ERROR_CODE[:card_declined],
'222' => STANDARD_ERROR_CODE[:incorrect_number],
'223' => STANDARD_ERROR_CODE[:expired_card],
'224' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'225' => STANDARD_ERROR_CODE[:invalid_cvc],
'240' => STANDARD_ERROR_CODE[:call_issuer],
'250' => STANDARD_ERROR_CODE[:pickup_card],
'251' => STANDARD_ERROR_CODE[:pickup_card],
'252' => STANDARD_ERROR_CODE[:pickup_card],
'253' => STANDARD_ERROR_CODE[:pickup_card],
'260' => STANDARD_ERROR_CODE[:card_declined],
'261' => STANDARD_ERROR_CODE[:card_declined],
'262' => STANDARD_ERROR_CODE[:card_declined],
'263' => STANDARD_ERROR_CODE[:processing_error],
'264' => STANDARD_ERROR_CODE[:card_declined],
'300' => STANDARD_ERROR_CODE[:card_declined],
'400' => STANDARD_ERROR_CODE[:processing_error],
'410' => STANDARD_ERROR_CODE[:processing_error],
'411' => STANDARD_ERROR_CODE[:processing_error],
'420' => STANDARD_ERROR_CODE[:processing_error],
'421' => STANDARD_ERROR_CODE[:processing_error],
'430' => STANDARD_ERROR_CODE[:processing_error],
'440' => STANDARD_ERROR_CODE[:processing_error],
'441' => STANDARD_ERROR_CODE[:processing_error],
'460' => STANDARD_ERROR_CODE[:invalid_number],
'461' => STANDARD_ERROR_CODE[:processing_error],
'801' => STANDARD_ERROR_CODE[:processing_error],
'811' => STANDARD_ERROR_CODE[:processing_error],
'812' => STANDARD_ERROR_CODE[:processing_error],
'813' => STANDARD_ERROR_CODE[:processing_error],
'814' => STANDARD_ERROR_CODE[:processing_error],
'815' => STANDARD_ERROR_CODE[:processing_error],
'823' => STANDARD_ERROR_CODE[:processing_error],
'824' => STANDARD_ERROR_CODE[:processing_error],
'881' => STANDARD_ERROR_CODE[:processing_error],
'882' => STANDARD_ERROR_CODE[:processing_error],
'883' => STANDARD_ERROR_CODE[:processing_error],
'884' => STANDARD_ERROR_CODE[:card_declined],
'885' => STANDARD_ERROR_CODE[:card_declined],
'886' => STANDARD_ERROR_CODE[:card_declined],
'887' => STANDARD_ERROR_CODE[:processing_error],
'888' => STANDARD_ERROR_CODE[:processing_error],
'889' => STANDARD_ERROR_CODE[:processing_error],
'890' => STANDARD_ERROR_CODE[:processing_error],
'891' => STANDARD_ERROR_CODE[:incorrect_cvc],
'892' => STANDARD_ERROR_CODE[:incorrect_cvc],
'893' => STANDARD_ERROR_CODE[:processing_error],
'894' => 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 = {}) ⇒ CamsGateway
constructor
A new instance of CamsGateway.
-
#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, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ CamsGateway
Returns a new instance of CamsGateway.
70
71
72
73
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 70
def initialize(options = {})
requires!(options, :username, :password)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
89
90
91
92
93
94
95
96
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 89
def authorize(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
add_address(post, payment, options)
commit('auth', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
98
99
100
101
102
103
104
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 98
def capture(money, authorization, options = {})
post = {}
add_reference(post, authorization)
add_invoice(post, money, options)
commit('capture', post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 75
def purchase(money, payment, options = {})
post = {}
add_invoice(post, money, options)
if payment.respond_to?(:number)
add_payment(post, payment)
add_address(post, payment, options)
elsif payment.kind_of?(String)
post[:transactionid] = split_authorization(payment)[0]
end
commit('sale', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
106
107
108
109
110
111
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 106
def refund(money, authorization, options = {})
post = {}
add_reference(post, authorization)
add_invoice(post, money, options)
commit('refund', post)
end
|
#scrub(transcript) ⇒ Object
131
132
133
134
135
136
137
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 131
def scrub(transcript)
%w(ccnumber cvv password).each do |field|
transcript = transcript.gsub(%r((#{field}=)[^&]+), '\1[FILTERED]\2')
end
transcript
end
|
#supports_scrubbing? ⇒ Boolean
127
128
129
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 127
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
119
120
121
122
123
124
125
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 119
def verify(credit_card, options = {})
post = {}
add_invoice(post, 0, options)
add_payment(post, credit_card)
add_address(post, credit_card, options)
commit('verify', post)
end
|
#void(authorization, options = {}) ⇒ Object
113
114
115
116
117
|
# File 'lib/active_merchant/billing/gateways/cams.rb', line 113
def void(authorization, options = {})
post = {}
add_reference(post, authorization)
commit('void', post)
end
|