File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 88 service : 'Checkout'
99 }
1010 end
11+
12+ it 'detects a namespace collision between Checkout and Payment PaymentsApi classes' do
13+ # Load both auto-generated PaymentsApi classes manually
14+ payment_api_path = File . expand_path ( '../lib/adyen/services/payment/payments_api.rb' , __dir__ )
15+ checkout_api_path = File . expand_path ( '../lib/adyen/services/checkout/payments_api.rb' , __dir__ )
16+
17+ load payment_api_path
18+ load checkout_api_path
19+
20+ # Instantiate what the Checkout facade will call
21+ checkout = Adyen ::Checkout . new ( @shared_values [ :client ] )
22+
23+ # Retrieve the PaymentsApi class reference that the facade resolves to
24+ resolved_class = checkout . payments_api . class
25+
26+ # Verify which service it actually represents
27+ service_name =
28+ if resolved_class . instance_methods . include? ( :service_name )
29+ resolved_class . new ( @shared_values [ :client ] , @shared_values [ :client ] . checkout . version ) . service_name
30+ else
31+ resolved_class . to_s
32+ end
33+
34+ puts "service_name"
35+ puts service_name
36+ # This expectation documents the current buggy behavior.
37+ # It should fail once the namespace is properly fixed.
38+ expect ( service_name )
39+ . to eq ( 'Adyen::PaymentsApi' ) ,
40+ "Expected Checkout.payments_api to instantiate the Checkout::PaymentsApi class, " \
41+ "but it appears to be using the Payment service implementation instead (#{ resolved_class } )"
42+ end
1143
1244 # must be created manually because every field in the response is an array
1345 it 'makes a payment_methods call' do
You can’t perform that action at this time.
0 commit comments