|
| 1 | +require_relative './service' |
| 2 | +module Adyen |
| 3 | + class PaymentsApp < Service |
| 4 | + attr_accessor :service, :version |
| 5 | + |
| 6 | + DEFAULT_VERSION = 1 |
| 7 | + def initialize(client, version = DEFAULT_VERSION) |
| 8 | + super(client, version, 'PaymentsApp') |
| 9 | + end |
| 10 | + |
| 11 | + def generate_payments_app_boarding_token_for_merchant(request, merchant_id, boarding_token_request, headers: {}) |
| 12 | + endpoint = '/merchants/{merchantId}/generatePaymentsAppBoardingToken'.gsub(/{.+?}/, '%s') |
| 13 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 14 | + endpoint = format(endpoint,_merchant_id) |
| 15 | + |
| 16 | + action = { method: 'post', url: endpoint } |
| 17 | + @client.call_adyen_api(@service, action, request, headers, @version) |
| 18 | + end |
| 19 | + |
| 20 | + def generate_payments_app_boarding_token_for_store(request, merchant_id, store_id, boarding_token_request, headers: {}) |
| 21 | + endpoint = '/merchants/{merchantId}/stores/{storeId}/generatePaymentsAppBoardingToken'.gsub(/{.+?}/, '%s') |
| 22 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 23 | + endpoint = format(endpoint,_merchant_id,_store_id) |
| 24 | + |
| 25 | + action = { method: 'post', url: endpoint } |
| 26 | + @client.call_adyen_api(@service, action, request, headers, @version) |
| 27 | + end |
| 28 | + |
| 29 | + def list_payments_app_for_merchant(merchant_id, headers: {}, query_params: {}) |
| 30 | + endpoint = '/merchants/{merchantId}/paymentsApps'.gsub(/{.+?}/, '%s') |
| 31 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 32 | + endpoint = format(endpoint,_merchant_id) |
| 33 | + endpoint += create_query_string(query_params) |
| 34 | + action = { method: 'get', url: endpoint } |
| 35 | + @client.call_adyen_api(@service, action, {}, headers, @version) |
| 36 | + end |
| 37 | + |
| 38 | + def list_payments_app_for_store(merchant_id, store_id, headers: {}, query_params: {}) |
| 39 | + endpoint = '/merchants/{merchantId}/stores/{storeId}/paymentsApps'.gsub(/{.+?}/, '%s') |
| 40 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 41 | + endpoint = format(endpoint,_merchant_id,_store_id) |
| 42 | + endpoint += create_query_string(query_params) |
| 43 | + action = { method: 'get', url: endpoint } |
| 44 | + @client.call_adyen_api(@service, action, {}, headers, @version) |
| 45 | + end |
| 46 | + |
| 47 | + def revoke_payments_app(merchant_id, installation_id, headers: {}) |
| 48 | + endpoint = '/merchants/{merchantId}/paymentsApps/{installationId}/revoke'.gsub(/{.+?}/, '%s') |
| 49 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 50 | + endpoint = format(endpoint,_merchant_id,_installation_id) |
| 51 | + |
| 52 | + action = { method: 'post', url: endpoint } |
| 53 | + @client.call_adyen_api(@service, action, {}, headers, @version) |
| 54 | + end |
| 55 | + |
| 56 | + end |
| 57 | +end |
0 commit comments