Skip to content

Update all services #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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