Skip to content

Commit

Permalink
Update CheckoutV2 3DS message & error code
Browse files Browse the repository at this point in the history
Update CheckoutV2 3DS message & error code to keep
waht was bening threed_response_message

Unit:
67 tests, 420 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote:
111 tests, 274 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
Alma Malambo committed Jul 17, 2024
1 parent 27ae6b7 commit 4b4ccb9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
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

0 comments on commit 4b4ccb9

Please sign in to comment.