Skip to content

Commit

Permalink
Update all services (#274)
Browse files Browse the repository at this point in the history
* false[adyen-sdk-automation] automated change

* removed classic sdk tests

---------

Co-authored-by: Djoyke Reijans <[email protected]>
  • Loading branch information
AdyenAutomationBot and DjoykeAbyah authored Nov 5, 2024
1 parent c8e2ff1 commit a1d3efa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 103 deletions.
5 changes: 0 additions & 5 deletions lib/adyen/services/checkout.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand Down
29 changes: 0 additions & 29 deletions lib/adyen/services/checkout/classic_checkout_sdk_api.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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{^/}, '')
Expand Down
33 changes: 0 additions & 33 deletions spec/checkout-oauth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
36 changes: 0 additions & 36 deletions spec/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit a1d3efa

Please sign in to comment.