Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Transfers API
*
* The version of the OpenAPI document: 4
*
*
* 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.transfers;
import com.adyen.Client;
import com.adyen.Service;
import com.adyen.constants.ApiConstants;
import java.time.OffsetDateTime;
import com.adyen.model.transfers.RestServiceError;
import com.adyen.model.transfers.Transaction;
import com.adyen.model.transfers.TransactionSearchResponse;
import com.adyen.model.RequestOptions;
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 TransactionsApi extends Service {
public static final String API_VERSION = "4";
protected String baseURL;
/**
* Transactions constructor in {@link com.adyen.service.transfers package}.
* @param client {@link Client } (required)
*/
public TransactionsApi(Client client) {
super(client);
this.baseURL = createBaseURL("https://balanceplatform-api-test.adyen.com/btl/v4");
}
/**
* Transactions constructor in {@link com.adyen.service.transfers 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 TransactionsApi(Client client, String baseURL) {
super(client);
this.baseURL = baseURL;
}
/**
* Get all transactions
*
* @param createdSince {@link OffsetDateTime } Only include transactions that have been created on or after this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**. (required)
* @param createdUntil {@link OffsetDateTime } Only include transactions that have been created on or before this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**. (required)
* @return {@link TransactionSearchResponse }
* @throws ApiException if fails to make API call
*/
public TransactionSearchResponse getAllTransactions(OffsetDateTime createdSince, OffsetDateTime createdUntil) throws ApiException, IOException {
return getAllTransactions(null, null, null, null, null, createdSince, createdUntil, null, null);
}
/**
* Get all transactions
*
* @param balancePlatform {@link String } Query: The unique identifier of the [balance platform](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balancePlatforms/{id}__queryParam_id). Required if you don't provide a `balanceAccountId` or `accountHolderId`. (optional)
* @param paymentInstrumentId {@link String } Query: The unique identifier of the [payment instrument](https://docs.adyen.com/api-explorer/balanceplatform/latest/get/paymentInstruments/_id_). To use this parameter, you must also provide a `balanceAccountId`, `accountHolderId`, or `balancePlatform`. The `paymentInstrumentId` must be related to the `balanceAccountId` or `accountHolderId` that you provide. (optional)
* @param accountHolderId {@link String } Query: The unique identifier of the [account holder](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/accountHolders/{id}__queryParam_id). Required if you don't provide a `balanceAccountId` or `balancePlatform`. If you provide a `balanceAccountId`, the `accountHolderId` must be related to the `balanceAccountId`. (optional)
* @param balanceAccountId {@link String } Query: The unique identifier of the [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balanceAccounts/{id}__queryParam_id). Required if you don't provide an `accountHolderId` or `balancePlatform`. If you provide an `accountHolderId`, the `balanceAccountId` must be related to the `accountHolderId`. (optional)
* @param cursor {@link String } Query: The `cursor` returned in the links of the previous response. (optional)
* @param createdSince {@link OffsetDateTime } Query: Only include transactions that have been created on or after this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**. (required)
* @param createdUntil {@link OffsetDateTime } Query: Only include transactions that have been created on or before this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**. (required)
* @param limit {@link Integer } Query: The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page. (optional)
* @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
* @return {@link TransactionSearchResponse }
* @throws ApiException if fails to make API call
*/
public TransactionSearchResponse getAllTransactions(String balancePlatform, String paymentInstrumentId, String accountHolderId, String balanceAccountId, String cursor, OffsetDateTime createdSince, OffsetDateTime createdUntil, Integer limit, RequestOptions requestOptions) throws ApiException, IOException {
//Add query params
Map queryParams = new HashMap<>();
if (balancePlatform != null) {
queryParams.put("balancePlatform", balancePlatform);
}
if (paymentInstrumentId != null) {
queryParams.put("paymentInstrumentId", paymentInstrumentId);
}
if (accountHolderId != null) {
queryParams.put("accountHolderId", accountHolderId);
}
if (balanceAccountId != null) {
queryParams.put("balanceAccountId", balanceAccountId);
}
if (cursor != null) {
queryParams.put("cursor", cursor);
}
if (createdSince != null) {
queryParams.put("createdSince", createdSince.toString());
}
if (createdUntil != null) {
queryParams.put("createdUntil", createdUntil.toString());
}
if (limit != null) {
queryParams.put("limit", limit.toString());
}
String requestBody = null;
Resource resource = new Resource(this, this.baseURL + "/transactions", null);
String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, null, queryParams);
return TransactionSearchResponse.fromJson(jsonResult);
}
/**
* Get a transaction
*
* @param id {@link String } The unique identifier of the transaction. (required)
* @return {@link Transaction }
* @throws ApiException if fails to make API call
*/
public Transaction getTransaction(String id) throws ApiException, IOException {
return getTransaction(id, null);
}
/**
* Get a transaction
*
* @param id {@link String } The unique identifier of the transaction. (required)
* @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
* @return {@link Transaction }
* @throws ApiException if fails to make API call
*/
public Transaction getTransaction(String id, RequestOptions requestOptions) throws ApiException, IOException {
//Add path params
Map pathParams = new HashMap<>();
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 + "/transactions/{id}", null);
String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
return Transaction.fromJson(jsonResult);
}
}