lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.102.0 vs lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.103.0
- old
+ new
@@ -319,18 +319,22 @@
end
def success?(response)
return FRAUD_WARNING_CODES.concat(['0']).include?(response['errors'].first['code']) if response['errors']
- !['DECLINED', 'CANCELLED'].include?(response['status']) && !['AuthenticationFailed'].include?(response['code'])
+ !['DECLINED', 'CANCELLED'].include?(response['status']) && !['AuthenticationFailed', 'AuthorizationFailed'].include?(response['code'])
end
def message_from(response)
response['errors'].present? ? response['errors'].map { |error_hash| error_hash['message'] }.join(' ') : response['status']
end
def errors_from(response)
- response['errors'].present? ? STANDARD_ERROR_CODE_MAPPING[response['errors'].first['code']] : ''
+ if ['AuthenticationFailed', 'AuthorizationFailed'].include?(response['code'])
+ response['code']
+ else
+ response['errors'].present? ? STANDARD_ERROR_CODE_MAPPING[response['errors'].first['code']] : ''
+ end
end
def authorization_from(response, headers = {})
[response['id'], headers['Request-Id']].join('|')
end