require_relative '../service'
module Adyen
class TerminalOrdersMerchantLevelApi < Service
attr_accessor :service, :version
def initialize(client, version = DEFAULT_VERSION)
super(client, version, 'Management')
end
def cancel_order(merchant_id, order_id, headers: {})
endpoint = '/merchants/{merchantId}/terminalOrders/{orderId}/cancel'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id, order_id)
action = { method: 'post', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def create_order(request, merchant_id, headers: {})
endpoint = '/merchants/{merchantId}/terminalOrders'.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 create_shipping_location(request, merchant_id, headers: {})
endpoint = '/merchants/{merchantId}/shippingLocations'.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 get_order(merchant_id, order_id, headers: {})
endpoint = '/merchants/{merchantId}/terminalOrders/{orderId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id, order_id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def list_billing_entities(merchant_id, headers: {}, query_params: {})
endpoint = '/merchants/{merchantId}/billingEntities'.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 list_orders(merchant_id, headers: {}, query_params: {})
endpoint = '/merchants/{merchantId}/terminalOrders'.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 list_shipping_locations(merchant_id, headers: {}, query_params: {})
endpoint = '/merchants/{merchantId}/shippingLocations'.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 list_terminal_models(merchant_id, headers: {})
endpoint = '/merchants/{merchantId}/terminalModels'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id)
action = { method: 'get', url: endpoint }
@client.call_adyen_api(@service, action, {}, headers, @version)
end
def list_terminal_products(merchant_id, headers: {}, query_params: {})
endpoint = '/merchants/{merchantId}/terminalProducts'.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 update_order(request, merchant_id, order_id, headers: {})
endpoint = '/merchants/{merchantId}/terminalOrders/{orderId}'.gsub(/{.+?}/, '%s')
endpoint = endpoint.gsub(%r{^/}, '')
endpoint = format(endpoint, merchant_id, order_id)
action = { method: 'patch', url: endpoint }
@client.call_adyen_api(@service, action, request, headers, @version)
end
end
end