forked from activemerchant/active_merchant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds 3DS 2.0 fields to credorax and a new field that is required for passing 3DS authenticated fields. Loaded suite test/remote/gateways/remote_credorax_test .......................... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 26 tests, 73 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Loaded suite test/unit/gateways/credorax_test ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 23 tests, 124 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Loading branch information
Niaja
committed
Sep 16, 2019
1 parent
76e034d
commit c9a851c
Showing
4 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,39 @@ def setup | |
@credit_card = credit_card('4176661000001015', verification_value: '281', month: '12', year: '2022') | ||
@fully_auth_card = credit_card('5223450000000007', brand: 'mastercard', verification_value: '090', month: '12', year: '2025') | ||
@declined_card = credit_card('4176661000001111', verification_value: '681', month: '12', year: '2022') | ||
@three_ds_card = credit_card('5185520050000010', verification_value: '737', month: '12', year: '2022') | ||
@options = { | ||
order_id: '1', | ||
currency: 'EUR', | ||
billing_address: address, | ||
description: 'Store Purchase' | ||
} | ||
@normalized_3ds_2_options = { | ||
reference: '345123', | ||
shopper_email: '[email protected]', | ||
shopper_ip: '77.110.174.153', | ||
shopper_reference: 'John Smith', | ||
billing_address: address(), | ||
shipping_address: address(), | ||
order_id: '123', | ||
execute_threed: true, | ||
three_ds_challenge_window_size: '01', | ||
stored_credential: {reason_type: 'unscheduled'}, | ||
three_ds_2: { | ||
channel: 'browser', | ||
notification_url: 'www.example.com', | ||
browser_info: { | ||
accept_header: 'unknown', | ||
depth: 24, | ||
java: false, | ||
language: 'US', | ||
height: 1000, | ||
width: 500, | ||
timezone: '-120', | ||
user_agent: 'unknown' | ||
} | ||
} | ||
} | ||
end | ||
|
||
def test_invalid_login | ||
|
@@ -49,6 +76,12 @@ def test_successful_purchase_with_auth_data_via_3ds1_fields | |
assert_equal 'Succeeded', response.message | ||
end | ||
|
||
def test_successful_purchase_with_3ds2_fields | ||
options = @options.merge(@normalized_3ds_2_options) | ||
response = @gateway.purchase(@amount, @three_ds_card, options) | ||
assert_equal 'Transaction pending cardholder authentication.', response.message | ||
end | ||
|
||
def test_successful_purchase_with_auth_data_via_normalized_3ds2_options | ||
version = '2.0' | ||
eci = '02' | ||
|
@@ -91,7 +124,7 @@ def test_failed_purchase_invalid_auth_data_via_3ds1_fields | |
def test_failed_purchase_invalid_auth_data_via_normalized_3ds2_options | ||
version = '2.0' | ||
eci = '02' | ||
cavv = 'BOGUS' | ||
cavv = 'BOGUS;:' | ||
ds_transaction_id = '97267598-FAE6-48F2-8083-C23433990FBC' | ||
options = @options.merge( | ||
three_d_secure: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,33 @@ def setup | |
billing_address: address, | ||
description: 'Store Purchase' | ||
} | ||
|
||
@normalized_3ds_2_options = { | ||
reference: '345123', | ||
shopper_email: '[email protected]', | ||
shopper_ip: '77.110.174.153', | ||
shopper_reference: 'John Smith', | ||
billing_address: address(), | ||
shipping_address: address(), | ||
order_id: '123', | ||
execute_threed: true, | ||
three_ds_challenge_window_size: '01', | ||
stored_credential: {reason_type: 'unscheduled'}, | ||
three_ds_2: { | ||
channel: 'browser', | ||
notification_url: 'www.example.com', | ||
browser_info: { | ||
accept_header: 'unknown', | ||
depth: 100, | ||
java: false, | ||
language: 'US', | ||
height: 1000, | ||
width: 500, | ||
timezone: '-120', | ||
user_agent: 'unknown' | ||
} | ||
} | ||
} | ||
end | ||
|
||
def test_successful_purchase | ||
|
@@ -174,6 +201,37 @@ def test_transcript_scrubbing | |
assert_equal scrubbed_transcript, @gateway.scrub(transcript) | ||
end | ||
|
||
def test_adds_3d2_secure_fields | ||
options_with_3ds = @normalized_3ds_2_options | ||
|
||
response = stub_comms do | ||
@gateway.purchase(@amount, @credit_card, options_with_3ds) | ||
end.check_request do |endpoint, data, headers| | ||
assert_match(/3ds_channel=02/, data) | ||
assert_match(/3ds_redirect_url=www.example.com/, data) | ||
assert_match(/3ds_challengewindowsize=01/, data) | ||
assert_match(/d5=unknown/, data) | ||
assert_match(/3ds_browsertz=-120/, data) | ||
assert_match(/3ds_browserscreenwidth=500/, data) | ||
assert_match(/3ds_browserscreenheight=1000/, data) | ||
assert_match(/3ds_browsercolordepth=100/, data) | ||
assert_match(/d6=US/, data) | ||
assert_match(/3ds_browserjavaenabled=false/, data) | ||
assert_match(/3ds_browseracceptheader=unknown/, data) | ||
assert_match(/3ds_shipaddrstate=ON/, data) | ||
assert_match(/3ds_shipaddrpostcode=K1C2N6/, data) | ||
assert_match(/3ds_shipaddrline2=Apt\+1/, data) | ||
assert_match(/3ds_shipaddrline1=456\+My\+Street/, data) | ||
assert_match(/3ds_shipaddrcountry=CA/, data) | ||
assert_match(/3ds_shipaddrcity=Ottawa/, data) | ||
end.respond_with(successful_purchase_response) | ||
|
||
assert_success response | ||
|
||
assert_equal '8a82944a5351570601535955efeb513c;006596;02617cf5f02ccaed239b6521748298c5;purchase', response.authorization | ||
assert response.test? | ||
end | ||
|
||
def test_adds_3d_secure_fields | ||
options_with_3ds = @options.merge({eci: 'sample-eci', cavv: 'sample-cavv', xid: 'sample-xid'}) | ||
|
||
|