@@ -5,9 +5,9 @@ class RemoteCheckoutV2Test < Test::Unit::TestCase
5
5
def setup
6
6
gateway_fixtures = fixtures ( :checkout_v2 )
7
7
gateway_token_fixtures = fixtures ( :checkout_v2_token )
8
- @gateway = CheckoutV2Gateway . new ( secret_key : gateway_fixtures [ :secret_key ] )
9
- @gateway_oauth = CheckoutV2Gateway . new ( { client_id : gateway_fixtures [ :client_id ] , client_secret : gateway_fixtures [ :client_secret ] } )
10
- @gateway_token = CheckoutV2Gateway . new ( secret_key : gateway_token_fixtures [ :secret_key ] , public_key : gateway_token_fixtures [ :public_key ] )
8
+ @gateway = CheckoutV2Gateway . new ( gateway_token_fixtures )
9
+ @gateway_basic_auth = CheckoutV2Gateway . new ( secret_key : gateway_fixtures [ :secret_key ] )
10
+ @gateway_oauth = CheckoutV2Gateway . new ( client_id : gateway_fixtures [ :client_id ] , client_secret : gateway_fixtures [ :client_secret ] )
11
11
12
12
@amount = 200
13
13
@credit_card = credit_card ( '4242424242424242' , verification_value : '100' , month : '6' , year : Time . now . year + 1 )
@@ -89,8 +89,7 @@ def setup
89
89
@additional_options = @options . merge (
90
90
card_on_file : true ,
91
91
transaction_indicator : 2 ,
92
- previous_charge_id : 'pay_123' ,
93
- processing_channel_id : 'pc_123'
92
+ previous_charge_id : 'pay_123'
94
93
)
95
94
@additional_options_3ds = @options . merge (
96
95
execute_threed : true ,
@@ -221,7 +220,7 @@ def test_network_transaction_scrubbing
221
220
def test_store_transcript_scrubbing
222
221
response = nil
223
222
transcript = capture_transcript ( @gateway ) do
224
- response = @gateway_token . store ( @credit_card , @options )
223
+ response = @gateway . store ( @credit_card , @options )
225
224
end
226
225
token = response . responses . first . params [ 'token' ]
227
226
transcript = @gateway . scrub ( transcript )
@@ -303,6 +302,12 @@ def test_successful_purchase_with_an_expired_access_token
303
302
end
304
303
end
305
304
305
+ def test_successful_purchase_for_secret_key_basic_authorization_header
306
+ response = @gateway_basic_auth . purchase ( @amount , @credit_card , @options )
307
+ assert_success response
308
+ assert_equal 'Succeeded' , response . message
309
+ end
310
+
306
311
def test_successful_purchase_with_vts_network_token
307
312
response = @gateway . purchase ( 100 , @vts_network_token , @options )
308
313
assert_success response
@@ -458,8 +463,8 @@ def test_successful_purchase_includes_avs_result
458
463
response = @gateway . purchase ( @amount , @credit_card , @options )
459
464
assert_success response
460
465
assert_equal 'Succeeded' , response . message
461
- assert_equal 'S ' , response . avs_result [ 'code' ]
462
- assert_equal 'U.S.- issuing bank does not support AVS.' , response . avs_result [ 'message' ]
466
+ assert_equal 'G ' , response . avs_result [ 'code' ]
467
+ assert_equal 'Non- U.S. issuing bank does not support AVS.' , response . avs_result [ 'message' ]
463
468
end
464
469
465
470
def test_successful_purchase_includes_avs_result_via_oauth
@@ -474,8 +479,8 @@ def test_successful_authorize_includes_avs_result
474
479
response = @gateway . authorize ( @amount , @credit_card , @options )
475
480
assert_success response
476
481
assert_equal 'Succeeded' , response . message
477
- assert_equal 'S ' , response . avs_result [ 'code' ]
478
- assert_equal 'U.S.- issuing bank does not support AVS.' , response . avs_result [ 'message' ]
482
+ assert_equal 'G ' , response . avs_result [ 'code' ]
483
+ assert_equal 'Non- U.S. issuing bank does not support AVS.' , response . avs_result [ 'message' ]
479
484
end
480
485
481
486
def test_successful_purchase_includes_cvv_result
@@ -528,7 +533,7 @@ def test_successful_authorize_with_estimated_type_via_oauth
528
533
end
529
534
530
535
def test_successful_authorize_with_processing_channel_id
531
- response = @gateway . authorize ( @amount , @credit_card , @options . merge ( { processing_channel_id : 'pc_ovo75iz4hdyudnx6tu74mum3fq' } ) )
536
+ response = @gateway . authorize ( @amount , @credit_card , @options )
532
537
assert_success response
533
538
assert_equal 'Succeeded' , response . message
534
539
end
@@ -563,7 +568,6 @@ def test_successful_purchase_with_processing_data
563
568
options = @options . merge (
564
569
processing : {
565
570
aft : true ,
566
- preferred_scheme : 'cartes_bancaires' ,
567
571
app_id : 'com.iap.linker_portal' ,
568
572
airline_data : [
569
573
{
@@ -718,19 +722,22 @@ def test_successful_purchase_with_metadata_via_oauth
718
722
end
719
723
720
724
def test_successful_purchase_with_minimal_options
721
- response = @gateway . purchase ( @amount , @credit_card , billing_address : address )
725
+ min_options = { billing_address : address , processing_channel_id : 'pc_lxgl7aqahkzubkundd2l546hdm' }
726
+ response = @gateway . purchase ( @amount , @credit_card , min_options )
722
727
assert_success response
723
728
assert_equal 'Succeeded' , response . message
724
729
end
725
730
726
731
def test_successful_purchase_with_shipping_address
727
- response = @gateway . purchase ( @amount , @credit_card , shipping_address : address )
732
+ min_options = { shipping_address : address , processing_channel_id : 'pc_lxgl7aqahkzubkundd2l546hdm' }
733
+ response = @gateway . purchase ( @amount , @credit_card , min_options )
728
734
assert_success response
729
735
assert_equal 'Succeeded' , response . message
730
736
end
731
737
732
738
def test_successful_purchase_without_phone_number
733
- response = @gateway . purchase ( @amount , @credit_card , billing_address : address . update ( phone : nil ) )
739
+ min_options = { billing_address : address . update ( phone : nil ) , processing_channel_id : 'pc_lxgl7aqahkzubkundd2l546hdm' }
740
+ response = @gateway . purchase ( @amount , @credit_card , min_options )
734
741
assert_success response
735
742
assert_equal 'Succeeded' , response . message
736
743
end
@@ -744,15 +751,15 @@ def test_successful_purchase_without_name
744
751
end
745
752
746
753
def test_successful_purchase_with_ip
747
- response = @gateway . purchase ( @amount , @credit_card , ip : '96.125.185.52' )
754
+ response = @gateway . purchase ( @amount , @credit_card , @options . merge ( ip : '96.125.185.52' ) )
748
755
assert_success response
749
756
assert_equal 'Succeeded' , response . message
750
757
end
751
758
752
759
def test_failed_purchase
753
760
response = @gateway . purchase ( 100 , @credit_card_dnh , @options )
754
761
assert_failure response
755
- assert_equal 'Invalid Card Number ' , response . message
762
+ assert_equal 'Declined - Do Not Honour ' , response . message
756
763
end
757
764
758
765
def test_failed_purchase_via_oauth
@@ -776,7 +783,7 @@ def test_avs_failed_authorize
776
783
def test_invalid_shipping_address
777
784
response = @gateway . authorize ( @amount , @credit_card , shipping_address : address . update ( country : 'Canada' ) )
778
785
assert_failure response
779
- assert_equal 'request_invalid: country_address_invalid ' , response . message
786
+ assert_equal 'request_invalid: address_country_invalid ' , response . message
780
787
end
781
788
782
789
def test_successful_authorize_and_capture
@@ -963,17 +970,17 @@ def test_money_transfer_payout_handles_blank_destination_address
963
970
end
964
971
965
972
def test_successful_store
966
- response = @gateway_token . store ( @credit_card , @options )
973
+ response = @gateway . store ( @credit_card , @options )
967
974
assert_success response
968
975
assert_equal 'Succeeded' , response . message
969
976
end
970
977
971
978
def test_successful_unstore_after_store
972
- store = @gateway_token . store ( @credit_card , @options )
979
+ store = @gateway . store ( @credit_card , @options )
973
980
assert_success store
974
981
assert_equal 'Succeeded' , store . message
975
982
source_id = store . params [ 'id' ]
976
- response = @gateway_token . unstore ( source_id , @options )
983
+ response = @gateway . unstore ( source_id , @options )
977
984
assert_success response
978
985
assert_equal response . params [ 'response_code' ] , '204'
979
986
end
@@ -1017,7 +1024,7 @@ def test_failed_store_oauth_credit_card
1017
1024
end
1018
1025
1019
1026
def test_successful_purchase_oauth_after_store_credit_card
1020
- store = @gateway_token . store ( @credit_card , @options )
1027
+ store = @gateway . store ( @credit_card , @options )
1021
1028
assert_success store
1022
1029
token = store . params [ 'id' ]
1023
1030
response = @gateway_oauth . purchase ( @amount , token , @options )
@@ -1193,8 +1200,8 @@ def test_failed_verify
1193
1200
def test_expired_card_returns_error_code
1194
1201
response = @gateway . purchase ( @amount , @expired_card , @options )
1195
1202
assert_failure response
1196
- assert_equal 'request_invalid : card_expired' , response . message
1197
- assert_equal 'request_invalid : card_expired' , response . error_code
1203
+ assert_equal 'processing_error : card_expired' , response . message
1204
+ assert_equal 'processing_error : card_expired' , response . error_code
1198
1205
end
1199
1206
1200
1207
def test_successful_purchase_with_idempotency_key
0 commit comments