com.wallee.sdk.service.TransactionService Maven / Gradle / Ivy
Show all versions of wallee-java-sdk Show documentation
package com.wallee.sdk.service;
import com.wallee.sdk.ApiClient;
import com.wallee.sdk.ErrorCode;
import com.wallee.sdk.WalleeSdkException;
import com.wallee.sdk.URIBuilderUtil;
import com.wallee.sdk.model.ClientError;
import com.wallee.sdk.model.EntityExportRequest;
import com.wallee.sdk.model.EntityQuery;
import com.wallee.sdk.model.EntityQueryFilter;
import com.wallee.sdk.model.PaymentMethodConfiguration;
import com.wallee.sdk.model.RenderedDocument;
import com.wallee.sdk.model.ServerError;
import com.wallee.sdk.model.TokenVersion;
import com.wallee.sdk.model.Transaction;
import com.wallee.sdk.model.TransactionCreate;
import com.wallee.sdk.model.TransactionLineItemVersion;
import com.wallee.sdk.model.TransactionPending;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.api.client.http.*;
import com.google.api.client.json.Json;
import org.apache.http.client.utils.URIBuilder;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
public class TransactionService {
private ApiClient apiClient;
public TransactionService(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Confirm
* The confirm operation marks the transaction as confirmed. Once the transaction is confirmed no more changes can be applied.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param transactionModel The transaction JSON object to update and confirm.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Confirm Documentation
**/
public Transaction confirm(Long spaceId, TransactionPending transactionModel) throws IOException {
HttpResponse response = confirmForHttpResponse(spaceId, transactionModel);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Confirm
* The confirm operation marks the transaction as confirmed. Once the transaction is confirmed no more changes can be applied.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param transactionModel The transaction JSON object to update and confirm.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Confirm Documentation
**/
public Transaction confirm(Long spaceId, TransactionPending transactionModel, Map params) throws IOException {
HttpResponse response = confirmForHttpResponse(spaceId, transactionModel, params);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse confirmForHttpResponse(Long spaceId, TransactionPending transactionModel) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling confirm");
}
// verify the required parameter 'transactionModel' is set
if (transactionModel == null) {
throw new IllegalArgumentException("Missing the required parameter 'transactionModel' when calling confirm");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/confirm");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(transactionModel);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse confirmForHttpResponse(Long spaceId, java.io.InputStream transactionModel, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling confirm");
}
// verify the required parameter 'transactionModel' is set
if (transactionModel == null) {
throw new IllegalArgumentException("Missing the required parameter 'transactionModel' when calling confirm");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/confirm");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = transactionModel == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, transactionModel);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse confirmForHttpResponse(Long spaceId, TransactionPending transactionModel, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling confirm");
}
// verify the required parameter 'transactionModel' is set
if (transactionModel == null) {
throw new IllegalArgumentException("Missing the required parameter 'transactionModel' when calling confirm");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/confirm");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(transactionModel);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Count
* Counts the number of items in the database as restricted by the given filter.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param filter The filter which restricts the entities which are used to calculate the count.
* @return Long
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Count Documentation
**/
public Long count(Long spaceId, EntityQueryFilter filter) throws IOException {
HttpResponse response = countForHttpResponse(spaceId, filter);
String returnType = "Long";
if(returnType.equals("String")){
return (Long) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Count
* Counts the number of items in the database as restricted by the given filter.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Long
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Count Documentation
**/
public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException {
HttpResponse response = countForHttpResponse(filter, spaceId, params);
String returnType = "Long";
if(returnType.equals("String")){
return (Long) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/count");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(filter);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/count");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = filter == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/count");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(filter);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Create
* Creates the entity with the given properties.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param transaction The transaction object which should be created.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Create Documentation
**/
public Transaction create(Long spaceId, TransactionCreate transaction) throws IOException {
HttpResponse response = createForHttpResponse(spaceId, transaction);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Create
* Creates the entity with the given properties.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param transaction The transaction object which should be created.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Create Documentation
**/
public Transaction create(Long spaceId, TransactionCreate transaction, Map params) throws IOException {
HttpResponse response = createForHttpResponse(spaceId, transaction, params);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse createForHttpResponse(Long spaceId, TransactionCreate transaction) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create");
}
// verify the required parameter 'transaction' is set
if (transaction == null) {
throw new IllegalArgumentException("Missing the required parameter 'transaction' when calling create");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/create");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(transaction);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse createForHttpResponse(Long spaceId, java.io.InputStream transaction, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create");
}
// verify the required parameter 'transaction' is set
if (transaction == null) {
throw new IllegalArgumentException("Missing the required parameter 'transaction' when calling create");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/create");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = transaction == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, transaction);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse createForHttpResponse(Long spaceId, TransactionCreate transaction, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create");
}
// verify the required parameter 'transaction' is set
if (transaction == null) {
throw new IllegalArgumentException("Missing the required parameter 'transaction' when calling create");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/create");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(transaction);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Create Transaction Credentials
* This operation allows to create transaction credentials to delegate temporarily the access to the web service API for this particular transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be returned.
* @return String
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Create Transaction Credentials Documentation
**/
public String createTransactionCredentials(Long spaceId, Long id) throws IOException {
HttpResponse response = createTransactionCredentialsForHttpResponse(spaceId, id);
String returnType = "String";
if(returnType.equals("String")){
return (String) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (String)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Create Transaction Credentials
* This operation allows to create transaction credentials to delegate temporarily the access to the web service API for this particular transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be returned.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return String
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Create Transaction Credentials Documentation
**/
public String createTransactionCredentials(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = createTransactionCredentialsForHttpResponse(spaceId, id, params);
String returnType = "String";
if(returnType.equals("String")){
return (String) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (String)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse createTransactionCredentialsForHttpResponse(Long spaceId, Long id) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling createTransactionCredentials");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling createTransactionCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/createTransactionCredentials");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (id != null) {
String key = "id";
Object value = id;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse createTransactionCredentialsForHttpResponse(Long spaceId, Long id, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling createTransactionCredentials");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling createTransactionCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/createTransactionCredentials");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
// Add the required query param 'id' to the map of query params
allParams.put("id", id);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Delete One-Click Token with Credentials
* This operation removes the given token.
* 442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param tokenId The token ID will be used to find the token which should be removed.
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Delete One-Click Token with Credentials Documentation
**/
public void deleteOneClickTokenWithCredentials(String credentials, Long tokenId) throws IOException {
deleteOneClickTokenWithCredentialsForHttpResponse(credentials, tokenId);
}
/**
* Delete One-Click Token with Credentials
* This operation removes the given token.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param tokenId The token ID will be used to find the token which should be removed.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Delete One-Click Token with Credentials Documentation
**/
public void deleteOneClickTokenWithCredentials(String credentials, Long tokenId, Map params) throws IOException {
deleteOneClickTokenWithCredentialsForHttpResponse(credentials, tokenId, params);
}
public HttpResponse deleteOneClickTokenWithCredentialsForHttpResponse(String credentials, Long tokenId) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling deleteOneClickTokenWithCredentials");
}
// verify the required parameter 'tokenId' is set
if (tokenId == null) {
throw new IllegalArgumentException("Missing the required parameter 'tokenId' when calling deleteOneClickTokenWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/deleteOneClickTokenWithCredentials");
if (credentials != null) {
String key = "credentials";
Object value = credentials;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (tokenId != null) {
String key = "tokenId";
Object value = tokenId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse deleteOneClickTokenWithCredentialsForHttpResponse(String credentials, Long tokenId, Map params) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling deleteOneClickTokenWithCredentials");
}
// verify the required parameter 'tokenId' is set
if (tokenId == null) {
throw new IllegalArgumentException("Missing the required parameter 'tokenId' when calling deleteOneClickTokenWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/deleteOneClickTokenWithCredentials");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'credentials' to the map of query params
allParams.put("credentials", credentials);
// Add the required query param 'tokenId' to the map of query params
allParams.put("tokenId", tokenId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Export
* Exports the transactions into a CSV file. The file will contain the properties defined in the request.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param request The request controls the entries which are exported.
* @return byte[]
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Export Documentation
**/
public byte[] export(Long spaceId, EntityExportRequest request) throws IOException {
HttpResponse response = exportForHttpResponse(spaceId, request);
String returnType = "byte[]";
if(returnType.equals("String")){
return (byte[]) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (byte[])apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Export
* Exports the transactions into a CSV file. The file will contain the properties defined in the request.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param request The request controls the entries which are exported.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return byte[]
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Export Documentation
**/
public byte[] export(Long spaceId, EntityExportRequest request, Map params) throws IOException {
HttpResponse response = exportForHttpResponse(spaceId, request, params);
String returnType = "byte[]";
if(returnType.equals("String")){
return (byte[]) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (byte[])apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse exportForHttpResponse(Long spaceId, EntityExportRequest request) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling export");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling export");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/export");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(request);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse exportForHttpResponse(Long spaceId, java.io.InputStream request, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling export");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling export");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/export");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = request == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, request);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse exportForHttpResponse(Long spaceId, EntityExportRequest request, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling export");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling export");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/export");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(request);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Fetch One Click Tokens with Credentials
* This operation returns the token version objects which references the tokens usable as one-click payment tokens for the provided transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @return List<TokenVersion>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Fetch One Click Tokens with Credentials Documentation
**/
public List fetchOneClickTokensWithCredentials(String credentials) throws IOException {
HttpResponse response = fetchOneClickTokensWithCredentialsForHttpResponse(credentials);
String returnType = "List<TokenVersion>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Fetch One Click Tokens with Credentials
* This operation returns the token version objects which references the tokens usable as one-click payment tokens for the provided transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return List<TokenVersion>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Fetch One Click Tokens with Credentials Documentation
**/
public List fetchOneClickTokensWithCredentials(String credentials, Map params) throws IOException {
HttpResponse response = fetchOneClickTokensWithCredentialsForHttpResponse(credentials, params);
String returnType = "List<TokenVersion>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse fetchOneClickTokensWithCredentialsForHttpResponse(String credentials) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling fetchOneClickTokensWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/fetchOneClickTokensWithCredentials");
if (credentials != null) {
String key = "credentials";
Object value = credentials;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse fetchOneClickTokensWithCredentialsForHttpResponse(String credentials, Map params) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling fetchOneClickTokensWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/fetchOneClickTokensWithCredentials");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'credentials' to the map of query params
allParams.put("credentials", credentials);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Fetch Possible Payment Methods
* This operation allows to get the payment method configurations which can be used with the provided transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be returned.
* @param integrationMode The integration mode defines the type of integration that is applied on the transaction.
* @return List<PaymentMethodConfiguration>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Fetch Possible Payment Methods Documentation
**/
public List fetchPaymentMethods(Long spaceId, Long id, String integrationMode) throws IOException {
HttpResponse response = fetchPaymentMethodsForHttpResponse(spaceId, id, integrationMode);
String returnType = "List<PaymentMethodConfiguration>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Fetch Possible Payment Methods
* This operation allows to get the payment method configurations which can be used with the provided transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be returned.
* @param integrationMode The integration mode defines the type of integration that is applied on the transaction.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return List<PaymentMethodConfiguration>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Fetch Possible Payment Methods Documentation
**/
public List fetchPaymentMethods(Long spaceId, Long id, String integrationMode, Map params) throws IOException {
HttpResponse response = fetchPaymentMethodsForHttpResponse(spaceId, id, integrationMode, params);
String returnType = "List<PaymentMethodConfiguration>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse fetchPaymentMethodsForHttpResponse(Long spaceId, Long id, String integrationMode) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling fetchPaymentMethods");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling fetchPaymentMethods");
}
// verify the required parameter 'integrationMode' is set
if (integrationMode == null) {
throw new IllegalArgumentException("Missing the required parameter 'integrationMode' when calling fetchPaymentMethods");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/fetch-payment-methods");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (id != null) {
String key = "id";
Object value = id;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (integrationMode != null) {
String key = "integrationMode";
Object value = integrationMode;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse fetchPaymentMethodsForHttpResponse(Long spaceId, Long id, String integrationMode, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling fetchPaymentMethods");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling fetchPaymentMethods");
}
// verify the required parameter 'integrationMode' is set
if (integrationMode == null) {
throw new IllegalArgumentException("Missing the required parameter 'integrationMode' when calling fetchPaymentMethods");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/fetch-payment-methods");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
// Add the required query param 'id' to the map of query params
allParams.put("id", id);
// Add the required query param 'integrationMode' to the map of query params
allParams.put("integrationMode", integrationMode);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Fetch Possible Payment Methods with Credentials
* This operation allows to get the payment method configurations which can be used with the provided transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param integrationMode The integration mode defines the type of integration that is applied on the transaction.
* @return List<PaymentMethodConfiguration>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Fetch Possible Payment Methods with Credentials Documentation
**/
public List fetchPaymentMethodsWithCredentials(String credentials, String integrationMode) throws IOException {
HttpResponse response = fetchPaymentMethodsWithCredentialsForHttpResponse(credentials, integrationMode);
String returnType = "List<PaymentMethodConfiguration>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Fetch Possible Payment Methods with Credentials
* This operation allows to get the payment method configurations which can be used with the provided transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param integrationMode The integration mode defines the type of integration that is applied on the transaction.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return List<PaymentMethodConfiguration>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Fetch Possible Payment Methods with Credentials Documentation
**/
public List fetchPaymentMethodsWithCredentials(String credentials, String integrationMode, Map params) throws IOException {
HttpResponse response = fetchPaymentMethodsWithCredentialsForHttpResponse(credentials, integrationMode, params);
String returnType = "List<PaymentMethodConfiguration>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse fetchPaymentMethodsWithCredentialsForHttpResponse(String credentials, String integrationMode) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling fetchPaymentMethodsWithCredentials");
}
// verify the required parameter 'integrationMode' is set
if (integrationMode == null) {
throw new IllegalArgumentException("Missing the required parameter 'integrationMode' when calling fetchPaymentMethodsWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/fetch-payment-methods-with-credentials");
if (credentials != null) {
String key = "credentials";
Object value = credentials;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (integrationMode != null) {
String key = "integrationMode";
Object value = integrationMode;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse fetchPaymentMethodsWithCredentialsForHttpResponse(String credentials, String integrationMode, Map params) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling fetchPaymentMethodsWithCredentials");
}
// verify the required parameter 'integrationMode' is set
if (integrationMode == null) {
throw new IllegalArgumentException("Missing the required parameter 'integrationMode' when calling fetchPaymentMethodsWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/fetch-payment-methods-with-credentials");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'credentials' to the map of query params
allParams.put("credentials", credentials);
// Add the required query param 'integrationMode' to the map of query params
allParams.put("integrationMode", integrationMode);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* getInvoiceDocument
* Returns the PDF document for the transaction invoice with given id.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction to get the invoice document for.
* @return RenderedDocument
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see getInvoiceDocument Documentation
**/
public RenderedDocument getInvoiceDocument(Long spaceId, Long id) throws IOException {
HttpResponse response = getInvoiceDocumentForHttpResponse(spaceId, id);
String returnType = "RenderedDocument";
if(returnType.equals("String")){
return (RenderedDocument) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (RenderedDocument)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* getInvoiceDocument
* Returns the PDF document for the transaction invoice with given id.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction to get the invoice document for.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return RenderedDocument
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see getInvoiceDocument Documentation
**/
public RenderedDocument getInvoiceDocument(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = getInvoiceDocumentForHttpResponse(spaceId, id, params);
String returnType = "RenderedDocument";
if(returnType.equals("String")){
return (RenderedDocument) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (RenderedDocument)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse getInvoiceDocumentForHttpResponse(Long spaceId, Long id) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling getInvoiceDocument");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling getInvoiceDocument");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/getInvoiceDocument");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (id != null) {
String key = "id";
Object value = id;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse getInvoiceDocumentForHttpResponse(Long spaceId, Long id, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling getInvoiceDocument");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling getInvoiceDocument");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/getInvoiceDocument");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
// Add the required query param 'id' to the map of query params
allParams.put("id", id);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* getLatestSuccessfulTransactionLineItemVersion
*
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction to get the latest line item version for.
* @return TransactionLineItemVersion
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see getLatestSuccessfulTransactionLineItemVersion Documentation
**/
public TransactionLineItemVersion getLatestTransactionLineItemVersion(Long spaceId, Long id) throws IOException {
HttpResponse response = getLatestTransactionLineItemVersionForHttpResponse(spaceId, id);
String returnType = "TransactionLineItemVersion";
if(returnType.equals("String")){
return (TransactionLineItemVersion) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (TransactionLineItemVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* getLatestSuccessfulTransactionLineItemVersion
*
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction to get the latest line item version for.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return TransactionLineItemVersion
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see getLatestSuccessfulTransactionLineItemVersion Documentation
**/
public TransactionLineItemVersion getLatestTransactionLineItemVersion(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = getLatestTransactionLineItemVersionForHttpResponse(spaceId, id, params);
String returnType = "TransactionLineItemVersion";
if(returnType.equals("String")){
return (TransactionLineItemVersion) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (TransactionLineItemVersion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse getLatestTransactionLineItemVersionForHttpResponse(Long spaceId, Long id) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling getLatestTransactionLineItemVersion");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling getLatestTransactionLineItemVersion");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/getLatestTransactionLineItemVersion");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (id != null) {
String key = "id";
Object value = id;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse getLatestTransactionLineItemVersionForHttpResponse(Long spaceId, Long id, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling getLatestTransactionLineItemVersion");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling getLatestTransactionLineItemVersion");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/getLatestTransactionLineItemVersion");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
// Add the required query param 'id' to the map of query params
allParams.put("id", id);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* getPackingSlip
* Returns the packing slip for the transaction with given id.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction to get the packing slip for.
* @return RenderedDocument
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see getPackingSlip Documentation
**/
public RenderedDocument getPackingSlip(Long spaceId, Long id) throws IOException {
HttpResponse response = getPackingSlipForHttpResponse(spaceId, id);
String returnType = "RenderedDocument";
if(returnType.equals("String")){
return (RenderedDocument) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (RenderedDocument)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* getPackingSlip
* Returns the packing slip for the transaction with given id.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction to get the packing slip for.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return RenderedDocument
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see getPackingSlip Documentation
**/
public RenderedDocument getPackingSlip(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = getPackingSlipForHttpResponse(spaceId, id, params);
String returnType = "RenderedDocument";
if(returnType.equals("String")){
return (RenderedDocument) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (RenderedDocument)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse getPackingSlipForHttpResponse(Long spaceId, Long id) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling getPackingSlip");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling getPackingSlip");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/getPackingSlip");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (id != null) {
String key = "id";
Object value = id;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse getPackingSlipForHttpResponse(Long spaceId, Long id, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling getPackingSlip");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling getPackingSlip");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/getPackingSlip");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
// Add the required query param 'id' to the map of query params
allParams.put("id", id);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Process One-Click Token with Credentials
* This operation assigns the given token to the transaction and process it. This method will return an URL where the customer has to be redirect to complete the transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param tokenId The token ID is used to load the corresponding token and to process the transaction with it.
* @return String
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Process One-Click Token with Credentials Documentation
**/
public String processOneClickTokenAndRedirectWithCredentials(String credentials, Long tokenId) throws IOException {
HttpResponse response = processOneClickTokenAndRedirectWithCredentialsForHttpResponse(credentials, tokenId);
String returnType = "String";
if(returnType.equals("String")){
return (String) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (String)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Process One-Click Token with Credentials
* This operation assigns the given token to the transaction and process it. This method will return an URL where the customer has to be redirect to complete the transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param tokenId The token ID is used to load the corresponding token and to process the transaction with it.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return String
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Process One-Click Token with Credentials Documentation
**/
public String processOneClickTokenAndRedirectWithCredentials(String credentials, Long tokenId, Map params) throws IOException {
HttpResponse response = processOneClickTokenAndRedirectWithCredentialsForHttpResponse(credentials, tokenId, params);
String returnType = "String";
if(returnType.equals("String")){
return (String) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (String)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse processOneClickTokenAndRedirectWithCredentialsForHttpResponse(String credentials, Long tokenId) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling processOneClickTokenAndRedirectWithCredentials");
}
// verify the required parameter 'tokenId' is set
if (tokenId == null) {
throw new IllegalArgumentException("Missing the required parameter 'tokenId' when calling processOneClickTokenAndRedirectWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/processOneClickTokenAndRedirectWithCredentials");
if (credentials != null) {
String key = "credentials";
Object value = credentials;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (tokenId != null) {
String key = "tokenId";
Object value = tokenId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse processOneClickTokenAndRedirectWithCredentialsForHttpResponse(String credentials, Long tokenId, Map params) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling processOneClickTokenAndRedirectWithCredentials");
}
// verify the required parameter 'tokenId' is set
if (tokenId == null) {
throw new IllegalArgumentException("Missing the required parameter 'tokenId' when calling processOneClickTokenAndRedirectWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/processOneClickTokenAndRedirectWithCredentials");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'credentials' to the map of query params
allParams.put("credentials", credentials);
// Add the required query param 'tokenId' to the map of query params
allParams.put("tokenId", tokenId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Process Without User Interaction
* This operation processes the transaction without requiring that the customer is present. Means this operation applies strategies to process the transaction without a direct interaction with the buyer. This operation is suitable for recurring transactions.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be processed.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Process Without User Interaction Documentation
**/
public Transaction processWithoutUserInteraction(Long spaceId, Long id) throws IOException {
HttpResponse response = processWithoutUserInteractionForHttpResponse(spaceId, id);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Process Without User Interaction
* This operation processes the transaction without requiring that the customer is present. Means this operation applies strategies to process the transaction without a direct interaction with the buyer. This operation is suitable for recurring transactions.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be processed.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Process Without User Interaction Documentation
**/
public Transaction processWithoutUserInteraction(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = processWithoutUserInteractionForHttpResponse(spaceId, id, params);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse processWithoutUserInteractionForHttpResponse(Long spaceId, Long id) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling processWithoutUserInteraction");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling processWithoutUserInteraction");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/processWithoutUserInteraction");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (id != null) {
String key = "id";
Object value = id;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse processWithoutUserInteractionForHttpResponse(Long spaceId, Long id, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling processWithoutUserInteraction");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling processWithoutUserInteraction");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/processWithoutUserInteraction");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
// Add the required query param 'id' to the map of query params
allParams.put("id", id);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Read
* Reads the entity with the given 'id' and returns it.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be returned.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Read Documentation
**/
public Transaction read(Long spaceId, Long id) throws IOException {
HttpResponse response = readForHttpResponse(spaceId, id);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Read
* Reads the entity with the given 'id' and returns it.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param id The id of the transaction which should be returned.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Read Documentation
**/
public Transaction read(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = readForHttpResponse(spaceId, id, params);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling read");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/read");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (id != null) {
String key = "id";
Object value = id;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling read");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/read");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
// Add the required query param 'id' to the map of query params
allParams.put("id", id);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Read With Credentials
* Reads the transaction with the given 'id' and returns it. This method uses the credentials to authenticate and identify the transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Read With Credentials Documentation
**/
public Transaction readWithCredentials(String credentials) throws IOException {
HttpResponse response = readWithCredentialsForHttpResponse(credentials);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Read With Credentials
* Reads the transaction with the given 'id' and returns it. This method uses the credentials to authenticate and identify the transaction.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param credentials The credentials identifies the transaction and contains the security details which grants the access this operation.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Read With Credentials Documentation
**/
public Transaction readWithCredentials(String credentials, Map params) throws IOException {
HttpResponse response = readWithCredentialsForHttpResponse(credentials, params);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse readWithCredentialsForHttpResponse(String credentials) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling readWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/readWithCredentials");
if (credentials != null) {
String key = "credentials";
Object value = credentials;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse readWithCredentialsForHttpResponse(String credentials, Map params) throws IOException {
// verify the required parameter 'credentials' is set
if (credentials == null) {
throw new IllegalArgumentException("Missing the required parameter 'credentials' when calling readWithCredentials");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/readWithCredentials");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'credentials' to the map of query params
allParams.put("credentials", credentials);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = null;
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
httpRequest.getHeaders().setContentType("*/*");
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Search
* Searches for the entities as specified by the given query.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param query The query restricts the transactions which are returned by the search.
* @return List<Transaction>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Search Documentation
**/
public List search(Long spaceId, EntityQuery query) throws IOException {
HttpResponse response = searchForHttpResponse(spaceId, query);
String returnType = "List<Transaction>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Search
* Searches for the entities as specified by the given query.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param query The query restricts the transactions which are returned by the search.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return List<Transaction>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Search Documentation
**/
public List search(Long spaceId, EntityQuery query, Map params) throws IOException {
HttpResponse response = searchForHttpResponse(spaceId, query, params);
String returnType = "List<Transaction>";
if(returnType.equals("String")){
return (List) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference>() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search");
}
// verify the required parameter 'query' is set
if (query == null) {
throw new IllegalArgumentException("Missing the required parameter 'query' when calling search");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/search");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(query);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search");
}
// verify the required parameter 'query' is set
if (query == null) {
throw new IllegalArgumentException("Missing the required parameter 'query' when calling search");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/search");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = query == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search");
}
// verify the required parameter 'query' is set
if (query == null) {
throw new IllegalArgumentException("Missing the required parameter 'query' when calling search");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/search");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(query);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Update
* This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param entity The transaction object with the properties which should be updated.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Documentation
**/
public Transaction update(Long spaceId, TransactionPending entity) throws IOException {
HttpResponse response = updateForHttpResponse(spaceId, entity);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Update
* This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
*
542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
* @param spaceId
* @param entity The transaction object with the properties which should be updated.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Transaction
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Documentation
**/
public Transaction update(Long spaceId, TransactionPending entity, Map params) throws IOException {
HttpResponse response = updateForHttpResponse(spaceId, entity, params);
String returnType = "Transaction";
if(returnType.equals("String")){
return (Transaction) (Object) response.parseAsString();
}
TypeReference typeRef = new TypeReference() {};
if (isNoBodyResponse(response)) {
throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName());
}
return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse updateForHttpResponse(Long spaceId, TransactionPending entity) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/update");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse updateForHttpResponse(Long spaceId, java.io.InputStream entity, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/update");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = entity == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse updateForHttpResponse(Long spaceId, TransactionPending entity, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction/update");
// Copy the params argument if present, to allow passing in immutable maps
Map allParams = params == null ? new HashMap() : new HashMap(params);
// Add the required query param 'spaceId' to the map of query params
allParams.put("spaceId", spaceId);
for (Map.Entry entryMap: allParams.entrySet()) {
String key = entryMap.getKey();
Object value = entryMap.getValue();
if (key != null && value != null) {
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = apiClient.new JacksonJsonHttpContent(entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
private boolean isNoBodyResponse(HttpResponse response) throws IOException {
java.io.InputStream content = response.getContent();
return content.available() == 0;
}
}