require_relative '../service'
module Adyen
class PaymentInstrumentsApi < Service
attr_accessor :service, :version
def initialize(client, version = DEFAULT_VERSION)
super(client, version, 'BalancePlatform')
end
def create_payment_instrument(request, headers: {})
endpoint = '/paymentInstruments'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint)
action = { method: 'post', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end
def get_all_transaction_rules_for_payment_instrument(id, headers: {})
endpoint = '/paymentInstruments/{id}/transactionRules'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def get_pan_of_payment_instrument(id, headers: {})
endpoint = '/paymentInstruments/{id}/reveal'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def get_payment_instrument(id, headers: {})
endpoint = '/paymentInstruments/{id}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def list_network_tokens(id, headers: {})
endpoint = '/paymentInstruments/{id}/networkTokens'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def update_payment_instrument(request, id, headers: {})
endpoint = '/paymentInstruments/{id}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, id)
action = { method: 'patch', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end
end
end