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 #5177

Merged
merged 1 commit into from
Jul 17, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* Braintree: Remove stored credential v1 [almalee24] #5175
* Braintree Blue: Pass overridden mid into client token for GS 3DS [sinourain] #5166
* Moneris: Update crypt_type for 3DS [almalee24] #5162
* CheckoutV2: Update 3DS message & error code [almalee24] #5177

== Version 1.136.0 (June 3, 2024)
* Shift4V2: Add new gateway based on SecurionPay adapter [heavyblade] #4860
Expand Down
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,23 +431,13 @@ 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
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 })
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
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' })
end.respond_with(failed_purchase_3ds_response)

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

Expand Down
Loading