All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adyen.service.PosTerminalManagement Maven / Gradle / Ivy

There is a newer version: 28.4.0
Show newest version
/*
 *                       ######
 *                       ######
 * ############    ####( ######  #####. ######  ############   ############
 * #############  #####( ######  #####. ######  #############  #############
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
 * #############  #############  #############  #############  #####  ######
 *  ############   ############  #############   ############  #####  ######
 *                                      ######
 *                               #############
 *                               ############
 *
 * Adyen Java API Library
 *
 * Copyright (c) 2020 Adyen B.V.
 * This file is open source and available under the MIT license.
 * See the LICENSE file for more info.
 */

package com.adyen.service;

import com.adyen.ApiKeyAuthenticatedService;
import com.adyen.Client;
import com.adyen.model.posterminalmanagement.AssignTerminalsRequest;
import com.adyen.model.posterminalmanagement.AssignTerminalsResponse;
import com.adyen.model.posterminalmanagement.FindTerminalRequest;
import com.adyen.model.posterminalmanagement.FindTerminalResponse;
import com.adyen.model.posterminalmanagement.GetStoresUnderAccountRequest;
import com.adyen.model.posterminalmanagement.GetStoresUnderAccountResponse;
import com.adyen.model.posterminalmanagement.GetTerminalDetailsRequest;
import com.adyen.model.posterminalmanagement.GetTerminalDetailsResponse;
import com.adyen.model.posterminalmanagement.GetTerminalsUnderAccountRequest;
import com.adyen.model.posterminalmanagement.GetTerminalsUnderAccountResponse;
import com.adyen.service.exception.ApiException;
import com.adyen.service.resource.posterminalmanagement.AssignTerminals;
import com.adyen.service.resource.posterminalmanagement.FindTerminal;
import com.adyen.service.resource.posterminalmanagement.GetStoresUnderAccount;
import com.adyen.service.resource.posterminalmanagement.GetTerminalDetails;
import com.adyen.service.resource.posterminalmanagement.GetTerminalsUnderAccount;
import com.google.gson.reflect.TypeToken;

import java.io.IOException;

public class PosTerminalManagement extends ApiKeyAuthenticatedService {

    private AssignTerminals assignTerminals;
    private FindTerminal findTerminal;
    private GetTerminalsUnderAccount getTerminalsUnderAccount;
    private GetStoresUnderAccount getStoresUnderAccount;
    private GetTerminalDetails getTerminalDetails;

    public PosTerminalManagement(Client client) {

        super(client);
        assignTerminals = new AssignTerminals(this);
        findTerminal = new FindTerminal(this);
        getTerminalsUnderAccount = new GetTerminalsUnderAccount(this);
        getStoresUnderAccount = new GetStoresUnderAccount(this);
        getTerminalDetails = new GetTerminalDetails(this);
    }

    /**
     * POST /assignTerminals API call
     *
     * @param assignTerminalsRequest
     * @return
     * @throws ApiException
     * @throws IOException
     */
    public AssignTerminalsResponse assignTerminals(AssignTerminalsRequest assignTerminalsRequest) throws ApiException, IOException {
        String jsonRequest = GSON.toJson(assignTerminalsRequest);
        String jsonResult = assignTerminals.request(jsonRequest);
        return GSON.fromJson(jsonResult, new TypeToken() {
        }.getType());
    }

    /**
     * POST /findTerminal API call
     *
     * @param findTerminalRequest
     * @return
     * @throws ApiException
     * @throws IOException
     */
    public FindTerminalResponse findTerminal(FindTerminalRequest findTerminalRequest) throws ApiException, IOException {
        String jsonRequest = GSON.toJson(findTerminalRequest);
        String jsonResult = findTerminal.request(jsonRequest);
        return GSON.fromJson(jsonResult, new TypeToken() {
        }.getType());
    }

    /**
     * POST /getTerminalsUnderAccount API call
     *
     * @param getTerminalsUnderAccountRequest
     * @return
     * @throws ApiException
     * @throws IOException
     */
    public GetTerminalsUnderAccountResponse getTerminalsUnderAccount(GetTerminalsUnderAccountRequest getTerminalsUnderAccountRequest) throws ApiException, IOException {
        String jsonRequest = GSON.toJson(getTerminalsUnderAccountRequest);
        String jsonResult = getTerminalsUnderAccount.request(jsonRequest);
        return GSON.fromJson(jsonResult, new TypeToken() {
        }.getType());
    }


    /**
     * POST /getStoresUnderAccount API call
     *
     * @param getStoresUnderAccountRequest
     * @return
     * @throws ApiException
     * @throws IOException
     */
    public GetStoresUnderAccountResponse getStoresUnderAccount(GetStoresUnderAccountRequest getStoresUnderAccountRequest) throws ApiException, IOException {
        String jsonRequest = GSON.toJson(getStoresUnderAccountRequest);
        String jsonResult = getStoresUnderAccount.request(jsonRequest);
        return GSON.fromJson(jsonResult, new TypeToken() {
        }.getType());
    }

    /**
     * POST /getTerminalDetails API call
     *
     * @param getTerminalDetailsRequest
     * @return
     * @throws ApiException
     * @throws IOException
     */
    public GetTerminalDetailsResponse getTerminalDetails(GetTerminalDetailsRequest getTerminalDetailsRequest) throws ApiException, IOException {
        String jsonRequest = GSON.toJson(getTerminalDetailsRequest);
        String jsonResult = getTerminalDetails.request(jsonRequest);
        return GSON.fromJson(jsonResult, new TypeToken() {
        }.getType());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy