@@ -18,20 +18,27 @@ def create_test(client, service, method_name, parent_object)
1818 request_body = JSON . parse ( json_from_file ( "mocks/requests/#{ service } /#{ method_name } .json" ) )
1919 response_body = json_from_file ( "mocks/responses/#{ service } /#{ method_name } .json" )
2020
21-
22- if service == 'Checkout' || service == 'CheckoutUtility'
21+ with_application_info = [
22+ "authorise" ,
23+ "authorise3d" ,
24+ "authorise3ds2" ,
25+ "payments" ,
26+ "payment_session" ,
27+ "payment_links" ,
28+ ]
29+ if with_application_info . include? ( method_name )
2330 client . add_application_info ( request_body )
2431 end
2532
2633 # client-generated headers
2734 headers = {
28- ' Content-Type' . to_sym => ' application/json'
35+ " Content-Type" . to_sym => " application/json" ,
2936 }
3037
3138 # authentication headers
32- if not client . api_key . nil? then
39+ if not client . api_key . nil?
3340 headers [ "x-api-key" ] = client . api_key
34- elsif not client . ws_user . nil? and not client . ws_password . nil? then
41+ elsif not client . ws_user . nil? and not client . ws_password . nil?
3542 auth_header = "Basic " + Base64 ::encode64 ( "#{ client . ws_user } :#{ client . ws_password } " )
3643 headers [ "Authorization" ] = auth_header . strip
3744 else
@@ -43,12 +50,12 @@ def create_test(client, service, method_name, parent_object)
4350 url = client . service_url ( service , action , parent_object . version )
4451 WebMock . stub_request ( :post , url ) .
4552 with (
46- body : request_body ,
47- headers : headers
48- ) .
53+ body : request_body ,
54+ headers : headers ,
55+ ) .
4956 to_return (
50- body : response_body
51- )
57+ body : response_body ,
58+ )
5259 result = parent_object . public_send ( method_name , request_body )
5360
5461 # result.response is already a Ruby object (Adyen::HashWithAccessors) (rather than an unparsed JSON string)
@@ -86,10 +93,10 @@ def create_client(auth_type)
8693 client = Adyen ::Client . new
8794 client . env = :mock
8895
89- if auth_type == :basic then
96+ if auth_type == :basic
9097 client . ws_user = "user"
9198 client . ws_password = "password"
92- elsif auth_type == :api_key then
99+ elsif auth_type == :api_key
93100 client . api_key = "api_key"
94101 else
95102 raise ArgumentError "Invalid auth type for test client"
0 commit comments