Class: Adyen::API::PaymentService::AuthorizationResponse
- Inherits:
-
Response
- Object
- Response
- Adyen::API::PaymentService::AuthorizationResponse
show all
- Defined in:
- lib/adyen/api.rb
Constant Summary
collapse
- ERRORS =
{
"validation 101 Invalid card number" => [:number, 'is not a valid creditcard number'],
"validation 103 CVC is not the right length" => [:cvc, 'is not the right length'],
"validation 128 Card Holder Missing" => [:holder_name, 'can’t be blank'],
"validation Couldn't parse expiry year" => [:expiry_year, 'could not be recognized'],
"validation Expiry month should be between 1 and 12 inclusive" => [:expiry_month, 'could not be recognized'],
}
- AUTHORISED =
'Authorised'
Instance Attribute Summary
Attributes inherited from Response
#http_response
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Response
#http_failure?, #initialize, response_attrs, #xml_querier
Class Method Details
.original_fault_message_for(attribute, message) ⇒ Object
238
239
240
241
242
243
244
|
# File 'lib/adyen/api.rb', line 238
def self.original_fault_message_for(attribute, message)
if error = ERRORS.find { |_, (a, m)| a == attribute && m == message }
error.first
else
message
end
end
|
Instance Method Details
#error ⇒ Object
258
259
260
|
# File 'lib/adyen/api.rb', line 258
def error
ERRORS[fault_message] || [:base, fault_message]
end
|
#invalid_request? ⇒ Boolean
254
255
256
|
# File 'lib/adyen/api.rb', line 254
def invalid_request?
!fault_message.nil?
end
|
#params ⇒ Object
262
263
264
265
266
267
268
269
270
271
|
# File 'lib/adyen/api.rb', line 262
def params
@params ||= xml_querier.xpath('//payment:authoriseResponse/payment:paymentResult') do |result|
{
:psp_reference => result.text('./payment:pspReference'),
:result_code => result.text('./payment:resultCode'),
:auth_code => result.text('./payment:authCode'),
:refusal_reason => result.text('./payment:refusalReason')
}
end
end
|
#success? ⇒ Boolean
Also known as:
authorized?
248
249
250
|
# File 'lib/adyen/api.rb', line 248
def success?
super && params[:result_code] == AUTHORISED
end
|