diff --git a/lib/adyen/services/paymentsApp.rb b/lib/adyen/services/paymentsApp.rb new file mode 100644 index 0000000..f7231d6 --- /dev/null +++ b/lib/adyen/services/paymentsApp.rb @@ -0,0 +1,19 @@ +require_relative 'paymentsApp/payments_app_api' + +module Adyen + class PaymentsApp + attr_accessor :service, :version + + DEFAULT_VERSION = 1 + def initialize(client, version = DEFAULT_VERSION) + @service = 'PaymentsApp' + @client = client + @version = version + end + + def payments_app_api + @payments_app_api ||= Adyen::PaymentsAppApi.new(@client, @version) + end + + end +end diff --git a/lib/adyen/services/paymentsApp/payments_app_api.rb b/lib/adyen/services/paymentsApp/payments_app_api.rb new file mode 100644 index 0000000..bb9ab47 --- /dev/null +++ b/lib/adyen/services/paymentsApp/payments_app_api.rb @@ -0,0 +1,56 @@ +require_relative '../service' +module Adyen + class PaymentsAppApi < Service + attr_accessor :service, :version + + def initialize(client, version = DEFAULT_VERSION) + super(client, version, 'PaymentsApp') + end + + def merchants_merchant_id_generate_payments_app_boarding_token_post(request, merchant_id, boarding_token_request, headers: {}) + endpoint = '/merchants/{merchantId}/generatePaymentsAppBoardingToken'.gsub(/{.+?}/, '%s') + endpoint = endpoint.gsub(%r{^/}, '') + endpoint = format(endpoint, merchant_id) + + action = { method: 'post', url: endpoint } + @client.call_adyen_api(@service, action, request, headers, @version) + end + + def merchants_merchant_id_payments_apps_get(merchant_id, headers: {}, query_params: {}) + endpoint = '/merchants/{merchantId}/paymentsApps'.gsub(/{.+?}/, '%s') + endpoint = endpoint.gsub(%r{^/}, '') + endpoint = format(endpoint, merchant_id) + endpoint += create_query_string(query_params) + action = { method: 'get', url: endpoint } + @client.call_adyen_api(@service, action, {}, headers, @version) + end + + def merchants_merchant_id_payments_apps_installation_id_revoke_post(merchant_id, installation_id, headers: {}) + endpoint = '/merchants/{merchantId}/paymentsApps/{installationId}/revoke'.gsub(/{.+?}/, '%s') + endpoint = endpoint.gsub(%r{^/}, '') + endpoint = format(endpoint, merchant_id, installation_id) + + action = { method: 'post', url: endpoint } + @client.call_adyen_api(@service, action, {}, headers, @version) + end + + def merchants_merchant_id_stores_store_id_generate_payments_app_boarding_token_post(request, merchant_id, store_id, boarding_token_request, headers: {}) + endpoint = '/merchants/{merchantId}/stores/{storeId}/generatePaymentsAppBoardingToken'.gsub(/{.+?}/, '%s') + endpoint = endpoint.gsub(%r{^/}, '') + endpoint = format(endpoint, merchant_id, store_id) + + action = { method: 'post', url: endpoint } + @client.call_adyen_api(@service, action, request, headers, @version) + end + + def merchants_merchant_id_stores_store_id_payments_apps_get(merchant_id, store_id, headers: {}, query_params: {}) + endpoint = '/merchants/{merchantId}/stores/{storeId}/paymentsApps'.gsub(/{.+?}/, '%s') + endpoint = endpoint.gsub(%r{^/}, '') + endpoint = format(endpoint, merchant_id, store_id) + endpoint += create_query_string(query_params) + action = { method: 'get', url: endpoint } + @client.call_adyen_api(@service, action, {}, headers, @version) + end + + end +end