Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CheckoutV2 3DS message & error code #5176

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions lib/active_merchant/billing/gateways/checkout_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,7 @@ def message_from(succeeded, response, options)
elsif response['error_type']
response['error_type'] + ': ' + response['error_codes'].first
else
response_summary = if options[:threeds_response_message]
response['response_summary'] || response.dig('actions', 0, 'response_summary')
else
response['response_summary']
end

response_summary = response['response_summary'] || response.dig('actions', 0, 'response_summary')
response_summary || response['response_code'] || response['status'] || response['message'] || 'Unable to read error message'
end
end
Expand Down Expand Up @@ -696,11 +691,7 @@ def error_code_from(succeeded, response, options)
elsif response['error_type']
response['error_type']
else
response_code = if options[:threeds_response_message]
response['response_code'] || response.dig('actions', 0, 'response_code')
else
response['response_code']
end
response_code = response['response_code'] || response.dig('actions', 0, 'response_code')

STANDARD_ERROR_CODE_MAPPING[response_code]
end
Expand Down
14 changes: 2 additions & 12 deletions test/unit/gateways/checkout_v2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,26 +431,16 @@ def test_failed_purchase
assert_equal Gateway::STANDARD_ERROR_CODE[:invalid_number], response.error_code
end

def test_failed_purchase_3ds_with_threeds_response_message
def test_failed_purchase_3ds
response = stub_comms(@gateway, :ssl_request) do
@gateway.purchase(@amount, @credit_card, { execute_threed: true, exemption: 'no_preference', challenge_indicator: 'trusted_listing', threeds_response_message: true })
@gateway.purchase(@amount, @credit_card, { execute_threed: true, exemption: 'no_preference', challenge_indicator: 'trusted_listing'})
end.respond_with(failed_purchase_3ds_response)

assert_failure response
assert_equal 'Insufficient Funds', response.message
assert_equal nil, response.error_code
end

def test_failed_purchase_3ds_without_threeds_response_message
response = stub_comms(@gateway, :ssl_request) do
@gateway.purchase(@amount, @credit_card, { execute_threed: true, exemption: 'no_preference', challenge_indicator: 'trusted_listing' })
end.respond_with(failed_purchase_3ds_response)

assert_failure response
assert_equal 'Declined', response.message
assert_equal nil, response.error_code
end

def test_successful_authorize_and_capture
response = stub_comms(@gateway, :ssl_request) do
@gateway.authorize(@amount, @credit_card)
Expand Down
Loading