From a1d3efa0a5939ba8c3af29bc8c1ee012d411f6dd Mon Sep 17 00:00:00 2001 From: AdyenAutomationBot <38424300+AdyenAutomationBot@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:56:51 +0100 Subject: [PATCH] Update all services (#274) * false[adyen-sdk-automation] automated change * removed classic sdk tests --------- Co-authored-by: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> --- lib/adyen/services/checkout.rb | 5 --- .../checkout/classic_checkout_sdk_api.rb | 29 --------------- .../terms_of_service_api.rb | 9 +++++ spec/checkout-oauth_spec.rb | 33 ----------------- spec/checkout_spec.rb | 36 ------------------- 5 files changed, 9 insertions(+), 103 deletions(-) delete mode 100644 lib/adyen/services/checkout/classic_checkout_sdk_api.rb diff --git a/lib/adyen/services/checkout.rb b/lib/adyen/services/checkout.rb index 77ef0efc..11a3ff09 100644 --- a/lib/adyen/services/checkout.rb +++ b/lib/adyen/services/checkout.rb @@ -1,4 +1,3 @@ -require_relative 'checkout/classic_checkout_sdk_api' require_relative 'checkout/donations_api' require_relative 'checkout/modifications_api' require_relative 'checkout/orders_api' @@ -18,10 +17,6 @@ def initialize(client, version = DEFAULT_VERSION) @version = version end - def classic_checkout_sdk_api - @classic_checkout_sdk_api ||= Adyen::ClassicCheckoutSDKApi.new(@client, @version) - end - def donations_api @donations_api ||= Adyen::DonationsApi.new(@client, @version) end diff --git a/lib/adyen/services/checkout/classic_checkout_sdk_api.rb b/lib/adyen/services/checkout/classic_checkout_sdk_api.rb deleted file mode 100644 index af4aff9b..00000000 --- a/lib/adyen/services/checkout/classic_checkout_sdk_api.rb +++ /dev/null @@ -1,29 +0,0 @@ -require_relative '../service' -module Adyen - class ClassicCheckoutSDKApi < Service - attr_accessor :service, :version - - def initialize(client, version = DEFAULT_VERSION) - super(client, version, 'Checkout') - end - - def payment_session(request, headers: {}) - endpoint = '/paymentSession'.gsub(/{.+?}/, '%s') - endpoint = endpoint.gsub(%r{^/}, '') - endpoint = format(endpoint) - - action = { method: 'post', url: endpoint } - @client.call_adyen_api(@service, action, request, headers, @version) - end - - def verify_payment_result(request, headers: {}) - endpoint = '/payments/result'.gsub(/{.+?}/, '%s') - endpoint = endpoint.gsub(%r{^/}, '') - endpoint = format(endpoint) - - action = { method: 'post', url: endpoint } - @client.call_adyen_api(@service, action, request, headers, @version) - end - - end -end diff --git a/lib/adyen/services/legalEntityManagement/terms_of_service_api.rb b/lib/adyen/services/legalEntityManagement/terms_of_service_api.rb index f91032c9..b69d238b 100644 --- a/lib/adyen/services/legalEntityManagement/terms_of_service_api.rb +++ b/lib/adyen/services/legalEntityManagement/terms_of_service_api.rb @@ -16,6 +16,15 @@ def accept_terms_of_service(request, id, termsofservicedocumentid, headers: {}) @client.call_adyen_api(@service, action, request, headers, @version) end + def get_accepted_terms_of_service_document(id, termsofserviceacceptancereference, headers: {}, query_params: {}) + endpoint = '/legalEntities/{id}/acceptedTermsOfServiceDocument/{termsofserviceacceptancereference}'.gsub(/{.+?}/, '%s') + endpoint = endpoint.gsub(%r{^/}, '') + endpoint = format(endpoint, id, termsofserviceacceptancereference) + endpoint += create_query_string(query_params) + action = { method: 'get', url: endpoint } + @client.call_adyen_api(@service, action, {}, headers, @version) + end + def get_terms_of_service_document(request, id, headers: {}) endpoint = '/legalEntities/{id}/termsOfService'.gsub(/{.+?}/, '%s') endpoint = endpoint.gsub(%r{^/}, '') diff --git a/spec/checkout-oauth_spec.rb b/spec/checkout-oauth_spec.rb index bda8f756..b1ca6d9e 100644 --- a/spec/checkout-oauth_spec.rb +++ b/spec/checkout-oauth_spec.rb @@ -105,39 +105,6 @@ to eq("RedirectShopper") end - # must be created manually due to payments/result format - it "makes a payments/result call" do - request_body = JSON.parse(json_from_file("mocks/requests/Checkout/payment-result.json")) - - response_body = json_from_file("mocks/responses/Checkout/payment-result.json") - - url = @shared_values[:client].service_url(@shared_values[:service], "payments/result", @shared_values[:client].checkout.version) - WebMock.stub_request(:post, url). - with( - body: request_body, - headers: @auth_header - ). - to_return( - body: response_body - ) - - result = @shared_values[:client].checkout.classic_checkout_sdk_api.verify_payment_result(request_body) - response_hash = result.response - - expect(result.status). - to eq(200) - expect(response_hash). - to eq(JSON.parse(response_body)) - expect(response_hash). - to be_a Adyen::HashWithAccessors - expect(response_hash). - to be_a_kind_of Hash - expect(response_hash["resultCode"]). - to eq("Authorised") - expect(response_hash.resultCode). - to eq("Authorised") - end - # must be created manually due to paymentsLinks format it "makes a paymentLinks call" do request_body = JSON.parse(json_from_file("mocks/requests/Checkout/payment_links.json")) diff --git a/spec/checkout_spec.rb b/spec/checkout_spec.rb index c3323943..2c0e6739 100644 --- a/spec/checkout_spec.rb +++ b/spec/checkout_spec.rb @@ -112,42 +112,6 @@ .to eq('RedirectShopper') end - # must be created manually due to payments/result format - it 'makes a payments/result call' do - request_body = JSON.parse(json_from_file('mocks/requests/Checkout/payment-result.json')) - - response_body = json_from_file('mocks/responses/Checkout/payment-result.json') - - url = @shared_values[:client].service_url(@shared_values[:service], 'payments/result', - @shared_values[:client].checkout.version) - WebMock.stub_request(:post, url) - .with( - body: request_body, - headers: { - 'x-api-key' => @shared_values[:client].api_key - } - ) - .to_return( - body: response_body - ) - - result = @shared_values[:client].checkout.classic_checkout_sdk_api.verify_payment_result(request_body) - response_hash = result.response - - expect(result.status) - .to eq(200) - expect(response_hash) - .to eq(JSON.parse(response_body)) - expect(response_hash) - .to be_a Adyen::HashWithAccessors - expect(response_hash) - .to be_a_kind_of Hash - expect(response_hash['resultCode']) - .to eq('Authorised') - expect(response_hash.resultCode) - .to eq('Authorised') - end - # must be created manually due to paymentsLinks format it 'makes a paymentLinks call' do request_body = JSON.parse(json_from_file('mocks/requests/Checkout/payment_links.json'))