|
| 1 | +require_relative '../service' |
| 2 | +module Adyen |
| 3 | + class ManageSCADevicesApi < Service |
| 4 | + attr_accessor :service, :version |
| 5 | + |
| 6 | + def initialize(client, version = DEFAULT_VERSION) |
| 7 | + super(client, version, 'BalancePlatform') |
| 8 | + end |
| 9 | + |
| 10 | + def complete_registration_of_sca_device(request, id, headers: {}) |
| 11 | + endpoint = '/registeredDevices/{id}'.gsub(/{.+?}/, '%s') |
| 12 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 13 | + endpoint = format(endpoint, id) |
| 14 | + |
| 15 | + action = { method: 'patch', url: endpoint } |
| 16 | + @client.call_adyen_api(@service, action, request, headers, @version) |
| 17 | + end |
| 18 | + |
| 19 | + def delete_registration_of_sca_device(id, headers: {}, query_params: {}) |
| 20 | + endpoint = '/registeredDevices/{id}'.gsub(/{.+?}/, '%s') |
| 21 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 22 | + endpoint = format(endpoint, id) |
| 23 | + endpoint += create_query_string(query_params) |
| 24 | + action = { method: 'delete', url: endpoint } |
| 25 | + @client.call_adyen_api(@service, action, {}, headers, @version) |
| 26 | + end |
| 27 | + |
| 28 | + def initiate_registration_of_sca_device(request, headers: {}) |
| 29 | + endpoint = '/registeredDevices'.gsub(/{.+?}/, '%s') |
| 30 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 31 | + endpoint = format(endpoint) |
| 32 | + |
| 33 | + action = { method: 'post', url: endpoint } |
| 34 | + @client.call_adyen_api(@service, action, request, headers, @version) |
| 35 | + end |
| 36 | + |
| 37 | + def list_registered_sca_devices(headers: {}, query_params: {}) |
| 38 | + endpoint = '/registeredDevices'.gsub(/{.+?}/, '%s') |
| 39 | + endpoint = endpoint.gsub(%r{^/}, '') |
| 40 | + endpoint = format(endpoint) |
| 41 | + endpoint += create_query_string(query_params) |
| 42 | + action = { method: 'get', url: endpoint } |
| 43 | + @client.call_adyen_api(@service, action, {}, headers, @version) |
| 44 | + end |
| 45 | + |
| 46 | + end |
| 47 | +end |
0 commit comments