@@ -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 )
@@ -458,8 +457,8 @@ def test_successful_purchase_includes_avs_result
458
457
response = @gateway . purchase ( @amount , @credit_card , @options )
459
458
assert_success response
460
459
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' ]
460
+ assert_equal 'G ' , response . avs_result [ 'code' ]
461
+ assert_equal 'Non- U.S. issuing bank does not support AVS.' , response . avs_result [ 'message' ]
463
462
end
464
463
465
464
def test_successful_purchase_includes_avs_result_via_oauth
@@ -474,8 +473,8 @@ def test_successful_authorize_includes_avs_result
474
473
response = @gateway . authorize ( @amount , @credit_card , @options )
475
474
assert_success response
476
475
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' ]
476
+ assert_equal 'G ' , response . avs_result [ 'code' ]
477
+ assert_equal 'Non- U.S. issuing bank does not support AVS.' , response . avs_result [ 'message' ]
479
478
end
480
479
481
480
def test_successful_purchase_includes_cvv_result
@@ -528,7 +527,7 @@ def test_successful_authorize_with_estimated_type_via_oauth
528
527
end
529
528
530
529
def test_successful_authorize_with_processing_channel_id
531
- response = @gateway . authorize ( @amount , @credit_card , @options . merge ( { processing_channel_id : 'pc_ovo75iz4hdyudnx6tu74mum3fq' } ) )
530
+ response = @gateway . authorize ( @amount , @credit_card , @options )
532
531
assert_success response
533
532
assert_equal 'Succeeded' , response . message
534
533
end
@@ -563,7 +562,6 @@ def test_successful_purchase_with_processing_data
563
562
options = @options . merge (
564
563
processing : {
565
564
aft : true ,
566
- preferred_scheme : 'cartes_bancaires' ,
567
565
app_id : 'com.iap.linker_portal' ,
568
566
airline_data : [
569
567
{
@@ -718,19 +716,22 @@ def test_successful_purchase_with_metadata_via_oauth
718
716
end
719
717
720
718
def test_successful_purchase_with_minimal_options
721
- response = @gateway . purchase ( @amount , @credit_card , billing_address : address )
719
+ min_options = { billing_address : address , processing_channel_id : 'pc_lxgl7aqahkzubkundd2l546hdm' }
720
+ response = @gateway . purchase ( @amount , @credit_card , min_options )
722
721
assert_success response
723
722
assert_equal 'Succeeded' , response . message
724
723
end
725
724
726
725
def test_successful_purchase_with_shipping_address
727
- response = @gateway . purchase ( @amount , @credit_card , shipping_address : address )
726
+ min_options = { shipping_address : address , processing_channel_id : 'pc_lxgl7aqahkzubkundd2l546hdm' }
727
+ response = @gateway . purchase ( @amount , @credit_card , min_options )
728
728
assert_success response
729
729
assert_equal 'Succeeded' , response . message
730
730
end
731
731
732
732
def test_successful_purchase_without_phone_number
733
- response = @gateway . purchase ( @amount , @credit_card , billing_address : address . update ( phone : nil ) )
733
+ min_options = { billing_address : address . update ( phone : nil ) , processing_channel_id : 'pc_lxgl7aqahkzubkundd2l546hdm' }
734
+ response = @gateway . purchase ( @amount , @credit_card , min_options )
734
735
assert_success response
735
736
assert_equal 'Succeeded' , response . message
736
737
end
@@ -744,15 +745,15 @@ def test_successful_purchase_without_name
744
745
end
745
746
746
747
def test_successful_purchase_with_ip
747
- response = @gateway . purchase ( @amount , @credit_card , ip : '96.125.185.52' )
748
+ response = @gateway . purchase ( @amount , @credit_card , @options . merge ( ip : '96.125.185.52' ) )
748
749
assert_success response
749
750
assert_equal 'Succeeded' , response . message
750
751
end
751
752
752
753
def test_failed_purchase
753
754
response = @gateway . purchase ( 100 , @credit_card_dnh , @options )
754
755
assert_failure response
755
- assert_equal 'Invalid Card Number ' , response . message
756
+ assert_equal 'Declined - Do Not Honour ' , response . message
756
757
end
757
758
758
759
def test_failed_purchase_via_oauth
@@ -776,7 +777,7 @@ def test_avs_failed_authorize
776
777
def test_invalid_shipping_address
777
778
response = @gateway . authorize ( @amount , @credit_card , shipping_address : address . update ( country : 'Canada' ) )
778
779
assert_failure response
779
- assert_equal 'request_invalid: country_address_invalid ' , response . message
780
+ assert_equal 'request_invalid: address_country_invalid ' , response . message
780
781
end
781
782
782
783
def test_successful_authorize_and_capture
@@ -925,7 +926,19 @@ def test_failed_capture_via_oauth
925
926
def test_successful_credit
926
927
@credit_card . first_name = 'John'
927
928
@credit_card . last_name = 'Doe'
928
- response = @gateway_oauth . credit ( @amount , @credit_card , @options . merge ( { source_type : 'currency_account' , source_id : 'ca_spwmped4qmqenai7hcghquqle4' , account_holder_type : 'individual' } ) )
929
+ destination = {
930
+ account_holder : {
931
+ phone : {
932
+ number : '9108675309' ,
933
+ country_code : '1'
934
+ } ,
935
+ identification : {
936
+ type : 'passport' ,
937
+ number : '12345788848438'
938
+ }
939
+ }
940
+ }
941
+ response = @gateway_oauth . credit ( @amount , @credit_card , @options . merge ( { source_type : 'currency_account' , source_id : 'ca_spwmped4qmqenai7hcghquqle4' , account_holder_type : 'individual' , payout : true , destination : } ) )
929
942
assert_success response
930
943
assert_equal 'Succeeded' , response . message
931
944
assert_equal true , response . primary_response . pending
@@ -947,33 +960,18 @@ def test_successful_money_transfer_payout_via_credit_corporate_account_holder_ty
947
960
assert_equal 'Succeeded' , response . message
948
961
end
949
962
950
- def test_money_transfer_payout_reverts_to_credit_if_payout_sent_as_nil
951
- @credit_card . first_name = 'John'
952
- @credit_card . last_name = 'Doe'
953
- response = @gateway_oauth . credit ( @amount , @credit_card , @payout_options . merge ( { account_holder_type : 'individual' , payout : nil } ) )
954
- assert_success response
955
- assert_equal 'Succeeded' , response . message
956
- end
957
-
958
- def test_money_transfer_payout_handles_blank_destination_address
959
- @payout_options [ :billing_address ] = nil
960
- response = @gateway_oauth . credit ( @amount , @credit_card , @payout_options . merge ( { account_holder_type : 'individual' , payout : true } ) )
961
- assert_success response
962
- assert_equal 'Succeeded' , response . message
963
- end
964
-
965
963
def test_successful_store
966
- response = @gateway_token . store ( @credit_card , @options )
964
+ response = @gateway . store ( @credit_card , @options )
967
965
assert_success response
968
966
assert_equal 'Succeeded' , response . message
969
967
end
970
968
971
969
def test_successful_unstore_after_store
972
- store = @gateway_token . store ( @credit_card , @options )
970
+ store = @gateway . store ( @credit_card , @options )
973
971
assert_success store
974
972
assert_equal 'Succeeded' , store . message
975
973
source_id = store . params [ 'id' ]
976
- response = @gateway_token . unstore ( source_id , @options )
974
+ response = @gateway . unstore ( source_id , @options )
977
975
assert_success response
978
976
assert_equal response . params [ 'response_code' ] , '204'
979
977
end
@@ -1017,7 +1015,7 @@ def test_failed_store_oauth_credit_card
1017
1015
end
1018
1016
1019
1017
def test_successful_purchase_oauth_after_store_credit_card
1020
- store = @gateway_token . store ( @credit_card , @options )
1018
+ store = @gateway . store ( @credit_card , @options )
1021
1019
assert_success store
1022
1020
token = store . params [ 'id' ]
1023
1021
response = @gateway_oauth . purchase ( @amount , token , @options )
@@ -1193,8 +1191,8 @@ def test_failed_verify
1193
1191
def test_expired_card_returns_error_code
1194
1192
response = @gateway . purchase ( @amount , @expired_card , @options )
1195
1193
assert_failure response
1196
- assert_equal 'request_invalid : card_expired' , response . message
1197
- assert_equal 'request_invalid : card_expired' , response . error_code
1194
+ assert_equal 'processing_error : card_expired' , response . message
1195
+ assert_equal 'processing_error : card_expired' , response . error_code
1198
1196
end
1199
1197
1200
1198
def test_successful_purchase_with_idempotency_key
0 commit comments