content: /*
   * Configuration API
   *
   * The version of the OpenAPI document: 2
   *
   *
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  
  package com.adyen.service.balanceplatform;
  
  import com.adyen.Client;
  import com.adyen.Service;
  import com.adyen.constants.ApiConstants;
  import com.adyen.model.RequestOptions;
  import com.adyen.model.balanceplatform.ApproveTransferLimitRequest;
  import com.adyen.model.balanceplatform.CreateTransferLimitRequest;
  import com.adyen.model.balanceplatform.LimitStatus;
  import com.adyen.model.balanceplatform.Scope;
  import com.adyen.model.balanceplatform.TransferLimit;
  import com.adyen.model.balanceplatform.TransferLimitListResponse;
  import com.adyen.model.balanceplatform.TransferType;
  import com.adyen.service.exception.ApiException;
  import com.adyen.service.resource.Resource;
  import java.io.IOException;
  import java.util.HashMap;
  import java.util.Map;
  
  public class TransferLimitsBalanceAccountLevelApi extends Service {
  
    public static final String API_VERSION = "2";
  
    protected String baseURL;
  
    /**
     * Transfer limits - balance account level constructor in {@link com.adyen.service.balanceplatform
     * package}.
     *
     * @param client {@link Client } (required)
     */
    public TransferLimitsBalanceAccountLevelApi(Client client) {
      super(client);
      this.baseURL = createBaseURL("https://balanceplatform-api-test.adyen.com/bcl/v2");
    }
  
    /**
     * Transfer limits - balance account level constructor in {@link com.adyen.service.balanceplatform
     * package}. Please use this constructor only if you would like to pass along your own url for
     * routing or testing purposes. The latest API version is defined in this class as a constant.
     *
     * @param client {@link Client } (required)
     * @param baseURL {@link String } (required)
     */
    public TransferLimitsBalanceAccountLevelApi(Client client, String baseURL) {
      super(client);
      this.baseURL = baseURL;
    }
  
    /**
     * Approve pending transfer limits
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param approveTransferLimitRequest {@link ApproveTransferLimitRequest } (required)
     * @param approveTransferLimitRequest {@link ApproveTransferLimitRequest } (required)
     * @throws ApiException if fails to make API call
     */
    public void approvePendingTransferLimits(
        String id, ApproveTransferLimitRequest approveTransferLimitRequest)
        throws ApiException, IOException {
      approvePendingTransferLimits(id, approveTransferLimitRequest, null);
    }
  
    /**
     * Approve pending transfer limits
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param approveTransferLimitRequest {@link ApproveTransferLimitRequest } (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @throws ApiException if fails to make API call
     */
    public void approvePendingTransferLimits(
        String id,
        ApproveTransferLimitRequest approveTransferLimitRequest,
        RequestOptions requestOptions)
        throws ApiException, IOException {
      // Add path params
      Map<String, String> pathParams = new HashMap<>();
      if (id == null) {
        throw new IllegalArgumentException("Please provide the id path parameter");
      }
      pathParams.put("id", id);
  
      String requestBody = approveTransferLimitRequest.toJson();
      Resource resource =
          new Resource(this, this.baseURL + "/balanceAccounts/{id}/transferLimits/approve", null);
      resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
    }
  
    /**
     * Create a transfer limit
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param createTransferLimitRequest {@link CreateTransferLimitRequest } (required)
     * @param createTransferLimitRequest {@link CreateTransferLimitRequest } (required)
     * @return {@link TransferLimit }
     * @throws ApiException if fails to make API call
     */
    public TransferLimit createTransferLimit(
        String id, CreateTransferLimitRequest createTransferLimitRequest)
        throws ApiException, IOException {
      return createTransferLimit(id, createTransferLimitRequest, null);
    }
  
    /**
     * Create a transfer limit
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param createTransferLimitRequest {@link CreateTransferLimitRequest } (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link TransferLimit }
     * @throws ApiException if fails to make API call
     */
    public TransferLimit createTransferLimit(
        String id,
        CreateTransferLimitRequest createTransferLimitRequest,
        RequestOptions requestOptions)
        throws ApiException, IOException {
      // Add path params
      Map<String, String> pathParams = new HashMap<>();
      if (id == null) {
        throw new IllegalArgumentException("Please provide the id path parameter");
      }
      pathParams.put("id", id);
  
      String requestBody = createTransferLimitRequest.toJson();
      Resource resource =
          new Resource(this, this.baseURL + "/balanceAccounts/{id}/transferLimits", null);
      String jsonResult =
          resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
      return TransferLimit.fromJson(jsonResult);
    }
  
    /**
     * Delete a scheduled or pending transfer limit
     *
     * @param transferLimitId {@link String } The unique identifier of the transfer limit. (required)
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @throws ApiException if fails to make API call
     */
    public void deletePendingTransferLimit(String transferLimitId, String id)
        throws ApiException, IOException {
      deletePendingTransferLimit(transferLimitId, id, null);
    }
  
    /**
     * Delete a scheduled or pending transfer limit
     *
     * @param transferLimitId {@link String } The unique identifier of the transfer limit. (required)
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @throws ApiException if fails to make API call
     */
    public void deletePendingTransferLimit(
        String transferLimitId, String id, RequestOptions requestOptions)
        throws ApiException, IOException {
      // Add path params
      Map<String, String> pathParams = new HashMap<>();
      if (transferLimitId == null) {
        throw new IllegalArgumentException("Please provide the transferLimitId path parameter");
      }
      pathParams.put("transferLimitId", transferLimitId);
      if (id == null) {
        throw new IllegalArgumentException("Please provide the id path parameter");
      }
      pathParams.put("id", id);
  
      String requestBody = null;
      Resource resource =
          new Resource(
              this, this.baseURL + "/balanceAccounts/{id}/transferLimits/{transferLimitId}", null);
      resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.DELETE, pathParams);
    }
  
    /**
     * Get all current transfer limits
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @return {@link TransferLimitListResponse }
     * @throws ApiException if fails to make API call
     */
    public TransferLimitListResponse getCurrentTransferLimits(String id)
        throws ApiException, IOException {
      return getCurrentTransferLimits(id, null, null, null);
    }
  
    /**
     * Get all current transfer limits
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param scope {@link Scope } Query: The scope to which the transfer limit applies. Possible
     *     values: * **perTransaction**: you set a maximum amount for each transfer made from the
     *     balance account or balance platform. * **perDay**: you set a maximum total amount for all
     *     transfers made from the balance account or balance platform in a day. (optional)
     * @param transferType {@link TransferType } Query: The type of transfer to which the limit
     *     applies. Possible values: * **instant**: the limit applies to transfers with an **instant**
     *     priority. * **all**: the limit applies to all transfers, regardless of priority. (optional)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link TransferLimitListResponse }
     * @throws ApiException if fails to make API call
     */
    public TransferLimitListResponse getCurrentTransferLimits(
        String id, Scope scope, TransferType transferType, RequestOptions requestOptions)
        throws ApiException, IOException {
      // Add path params
      Map<String, String> pathParams = new HashMap<>();
      if (id == null) {
        throw new IllegalArgumentException("Please provide the id path parameter");
      }
      pathParams.put("id", id);
  
      // Add query params
      Map<String, String> queryParams = new HashMap<>();
      if (scope != null) {
        queryParams.put("scope", scope.toString());
      }
      if (transferType != null) {
        queryParams.put("transferType", transferType.toString());
      }
  
      String requestBody = null;
      Resource resource =
          new Resource(this, this.baseURL + "/balanceAccounts/{id}/transferLimits/current", null);
      String jsonResult =
          resource.request(
              requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams, queryParams);
      return TransferLimitListResponse.fromJson(jsonResult);
    }
  
    /**
     * Get the details of a transfer limit
     *
     * @param transferLimitId {@link String } The unique identifier of the transfer limit. (required)
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @return {@link TransferLimit }
     * @throws ApiException if fails to make API call
     */
    public TransferLimit getSpecificTransferLimit(String transferLimitId, String id)
        throws ApiException, IOException {
      return getSpecificTransferLimit(transferLimitId, id, null);
    }
  
    /**
     * Get the details of a transfer limit
     *
     * @param transferLimitId {@link String } The unique identifier of the transfer limit. (required)
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link TransferLimit }
     * @throws ApiException if fails to make API call
     */
    public TransferLimit getSpecificTransferLimit(
        String transferLimitId, String id, RequestOptions requestOptions)
        throws ApiException, IOException {
      // Add path params
      Map<String, String> pathParams = new HashMap<>();
      if (transferLimitId == null) {
        throw new IllegalArgumentException("Please provide the transferLimitId path parameter");
      }
      pathParams.put("transferLimitId", transferLimitId);
      if (id == null) {
        throw new IllegalArgumentException("Please provide the id path parameter");
      }
      pathParams.put("id", id);
  
      String requestBody = null;
      Resource resource =
          new Resource(
              this, this.baseURL + "/balanceAccounts/{id}/transferLimits/{transferLimitId}", null);
      String jsonResult =
          resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
      return TransferLimit.fromJson(jsonResult);
    }
  
    /**
     * Filter and view the transfer limits
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @return {@link TransferLimitListResponse }
     * @throws ApiException if fails to make API call
     */
    public TransferLimitListResponse getTransferLimits(String id) throws ApiException, IOException {
      return getTransferLimits(id, null, null, null, null);
    }
  
    /**
     * Filter and view the transfer limits
     *
     * @param id {@link String } The unique identifier of the balance account. (required)
     * @param scope {@link Scope } Query: The scope to which the transfer limit applies. Possible
     *     values: * **perTransaction**: you set a maximum amount for each transfer made from the
     *     balance account or balance platform. * **perDay**: you set a maximum total amount for all
     *     transfers made from the balance account or balance platform in a day. (optional)
     * @param transferType {@link TransferType } Query: The type of transfer to which the limit
     *     applies. Possible values: * **instant**: the limit applies to transfers with an **instant**
     *     priority. * **all**: the limit applies to all transfers, regardless of priority. (optional)
     * @param status {@link LimitStatus } Query: The status of the transfer limit. Possible values: *
     *     **active**: the limit is currently active. * **inactive**: the limit is currently inactive.
     *     * **pendingSCA**: the limit is pending until your user performs SCA. * **scheduled**: the
     *     limit is scheduled to become active at a future date. (optional)
     * @param requestOptions {@link RequestOptions } Object to store additional data such as
     *     idempotency-keys (optional)
     * @return {@link TransferLimitListResponse }
     * @throws ApiException if fails to make API call
     */
    public TransferLimitListResponse getTransferLimits(
        String id,
        Scope scope,
        TransferType transferType,
        LimitStatus status,
        RequestOptions requestOptions)
        throws ApiException, IOException {
      // Add path params
      Map<String, String> pathParams = new HashMap<>();
      if (id == null) {
        throw new IllegalArgumentException("Please provide the id path parameter");
      }
      pathParams.put("id", id);
  
      // Add query params
      Map<String, String> queryParams = new HashMap<>();
      if (scope != null) {
        queryParams.put("scope", scope.toString());
      }
      if (transferType != null) {
        queryParams.put("transferType", transferType.toString());
      }
      if (status != null) {
        queryParams.put("status", status.toString());
      }
  
      String requestBody = null;
      Resource resource =
          new Resource(this, this.baseURL + "/balanceAccounts/{id}/transferLimits", null);
      String jsonResult =
          resource.request(
              requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams, queryParams);
      return TransferLimitListResponse.fromJson(jsonResult);
    }
  }
  