com.wallee.sdk.service.PaymentWebAppService Maven / Gradle / Ivy
package com.wallee.sdk.service;
import static com.wallee.sdk.ErrorCode.*;
import com.wallee.sdk.ApiClient;
import com.wallee.sdk.ErrorCode;
import com.wallee.sdk.exception.WalleeSdkException;
import com.wallee.sdk.util.URIBuilderUtil;
import com.wallee.sdk.StringUtil;
import com.wallee.sdk.model.ChargeAttempt;
import com.wallee.sdk.model.ClientError;
import com.wallee.sdk.model.PaymentAppChargeAttemptUpdateRequest;
import com.wallee.sdk.model.PaymentAppCompletionUpdateRequest;
import com.wallee.sdk.model.PaymentAppConnector;
import com.wallee.sdk.model.PaymentAppConnectorCreationRequest;
import com.wallee.sdk.model.PaymentAppProcessor;
import com.wallee.sdk.model.PaymentAppProcessorCreationRequest;
import com.wallee.sdk.model.PaymentAppRefundUpdateRequest;
import com.wallee.sdk.model.PaymentAppVoidUpdateRequest;
import com.wallee.sdk.model.Refund;
import com.wallee.sdk.model.ServerError;
import com.wallee.sdk.model.TransactionCompletion;
import com.wallee.sdk.model.TransactionVoid;
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;
import java.util.Objects;
public class PaymentWebAppService {
private ApiClient apiClient;
public PaymentWebAppService(ApiClient apiClient) {
this.apiClient = Objects.requireNonNull(apiClient, "ApiClient must be non null");
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = Objects.requireNonNull(apiClient, "ApiClient must be non null");
}
/**
* Activate Processor for Production
* This operation marks the processor to be usable within the production environment.
* 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 The space ID identifies the space in which the processor is installed in.
* @param externalId The external ID identifies the processor. The external ID corresponds to the ID provided during inserting of the processor.
* @return PaymentAppProcessor
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Activate Processor for Production Documentation
**/
public PaymentAppProcessor activateProcessorForProduction(Long spaceId, String externalId) throws IOException {
HttpResponse response = activateProcessorForProductionForHttpResponse(spaceId, externalId);
String returnType = "PaymentAppProcessor";
if(returnType.equals("String")){
return (PaymentAppProcessor) (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 (PaymentAppProcessor)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Activate Processor for Production
* This operation marks the processor to be usable within the production environment.
* 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 The space ID identifies the space in which the processor is installed in.
* @param externalId The external ID identifies the processor. The external ID corresponds to the ID provided during inserting of the processor.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return PaymentAppProcessor
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Activate Processor for Production Documentation
**/
public PaymentAppProcessor activateProcessorForProduction(Long spaceId, String externalId, Map params) throws IOException {
HttpResponse response = activateProcessorForProductionForHttpResponse(spaceId, externalId, params);
String returnType = "PaymentAppProcessor";
if(returnType.equals("String")){
return (PaymentAppProcessor) (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 (PaymentAppProcessor)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse activateProcessorForProductionForHttpResponse(Long spaceId, String externalId) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling activateProcessorForProduction");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling activateProcessorForProduction");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/activate-processor-for-production");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (externalId != null) {
String key = "externalId";
Object value = externalId;
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 activateProcessorForProductionForHttpResponse(Long spaceId, String externalId, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling activateProcessorForProduction");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling activateProcessorForProduction");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/activate-processor-for-production");
// 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 'externalId' to the map of query params
allParams.put("externalId", externalId);
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 Connector
* This operation removes the web app payment connector from the given space.
* 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 The space ID identifies the space in which the connector is installed in.
* @param externalId The external ID identifies the connector. The external ID corresponds to the ID provided during inserting of the connector.
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Delete Connector Documentation
**/
public void deleteConnector(Long spaceId, String externalId) throws IOException {
deleteConnectorForHttpResponse(spaceId, externalId);
}
/**
* Delete Connector
* This operation removes the web app payment connector from the given space.
*
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 The space ID identifies the space in which the connector is installed in.
* @param externalId The external ID identifies the connector. The external ID corresponds to the ID provided during inserting of the connector.
* @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 Connector Documentation
**/
public void deleteConnector(Long spaceId, String externalId, Map params) throws IOException {
deleteConnectorForHttpResponse(spaceId, externalId, params);
}
public HttpResponse deleteConnectorForHttpResponse(Long spaceId, String externalId) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling deleteConnector");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling deleteConnector");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/delete-connector");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (externalId != null) {
String key = "externalId";
Object value = externalId;
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 deleteConnectorForHttpResponse(Long spaceId, String externalId, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling deleteConnector");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling deleteConnector");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/delete-connector");
// 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 'externalId' to the map of query params
allParams.put("externalId", externalId);
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 Processor
* This operation removes the web app payment processor and its connectors from the given space.
* 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 The space ID identifies the space in which the processor is installed in.
* @param externalId The external ID identifies the processor. The external ID corresponds to the ID provided during inserting of the processor.
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Delete Processor Documentation
**/
public void deleteProcessor(Long spaceId, String externalId) throws IOException {
deleteProcessorForHttpResponse(spaceId, externalId);
}
/**
* Delete Processor
* This operation removes the web app payment processor and its connectors from the given space.
*
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 The space ID identifies the space in which the processor is installed in.
* @param externalId The external ID identifies the processor. The external ID corresponds to the ID provided during inserting of the processor.
* @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 Processor Documentation
**/
public void deleteProcessor(Long spaceId, String externalId, Map params) throws IOException {
deleteProcessorForHttpResponse(spaceId, externalId, params);
}
public HttpResponse deleteProcessorForHttpResponse(Long spaceId, String externalId) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling deleteProcessor");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling deleteProcessor");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/delete-processor");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (externalId != null) {
String key = "externalId";
Object value = externalId;
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 deleteProcessorForHttpResponse(Long spaceId, String externalId, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling deleteProcessor");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling deleteProcessor");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/delete-processor");
// 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 'externalId' to the map of query params
allParams.put("externalId", externalId);
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();
}
/**
* Insert or Update Connector
* This operation inserts or updates a web app payment connector.
* 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 The space ID identifies the space into which the connector should be inserted into.
* @param request The connector object contains all the details required to create or update a web app connector.
* @return PaymentAppConnector
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Insert or Update Connector Documentation
**/
public PaymentAppConnector insertOrUpdateConnector(Long spaceId, PaymentAppConnectorCreationRequest request) throws IOException {
HttpResponse response = insertOrUpdateConnectorForHttpResponse(spaceId, request);
String returnType = "PaymentAppConnector";
if(returnType.equals("String")){
return (PaymentAppConnector) (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 (PaymentAppConnector)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Insert or Update Connector
* This operation inserts or updates a web app payment connector.
* 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 The space ID identifies the space into which the connector should be inserted into.
* @param request The connector object contains all the details required to create or update a web app connector.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return PaymentAppConnector
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Insert or Update Connector Documentation
**/
public PaymentAppConnector insertOrUpdateConnector(Long spaceId, PaymentAppConnectorCreationRequest request, Map params) throws IOException {
HttpResponse response = insertOrUpdateConnectorForHttpResponse(spaceId, request, params);
String returnType = "PaymentAppConnector";
if(returnType.equals("String")){
return (PaymentAppConnector) (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 (PaymentAppConnector)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse insertOrUpdateConnectorForHttpResponse(Long spaceId, PaymentAppConnectorCreationRequest request) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling insertOrUpdateConnector");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling insertOrUpdateConnector");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/insert-or-update-connector");
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 insertOrUpdateConnectorForHttpResponse(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 insertOrUpdateConnector");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling insertOrUpdateConnector");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/insert-or-update-connector");
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 insertOrUpdateConnectorForHttpResponse(Long spaceId, PaymentAppConnectorCreationRequest 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 insertOrUpdateConnector");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling insertOrUpdateConnector");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/insert-or-update-connector");
// 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();
}
/**
* Insert or Update Processor
* This operation inserts or updates a web app payment processor.
* 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 The space ID identifies the space into which the processor should be inserted into.
* @param request The processor object contains all the details required to create or update a web app processor.
* @return PaymentAppProcessor
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Insert or Update Processor Documentation
**/
public PaymentAppProcessor insertOrUpdateProcessor(Long spaceId, PaymentAppProcessorCreationRequest request) throws IOException {
HttpResponse response = insertOrUpdateProcessorForHttpResponse(spaceId, request);
String returnType = "PaymentAppProcessor";
if(returnType.equals("String")){
return (PaymentAppProcessor) (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 (PaymentAppProcessor)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Insert or Update Processor
* This operation inserts or updates a web app payment processor.
* 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 The space ID identifies the space into which the processor should be inserted into.
* @param request The processor object contains all the details required to create or update a web app processor.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return PaymentAppProcessor
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Insert or Update Processor Documentation
**/
public PaymentAppProcessor insertOrUpdateProcessor(Long spaceId, PaymentAppProcessorCreationRequest request, Map params) throws IOException {
HttpResponse response = insertOrUpdateProcessorForHttpResponse(spaceId, request, params);
String returnType = "PaymentAppProcessor";
if(returnType.equals("String")){
return (PaymentAppProcessor) (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 (PaymentAppProcessor)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse insertOrUpdateProcessorForHttpResponse(Long spaceId, PaymentAppProcessorCreationRequest request) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling insertOrUpdateProcessor");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling insertOrUpdateProcessor");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/insert-or-update-processor");
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 insertOrUpdateProcessorForHttpResponse(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 insertOrUpdateProcessor");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling insertOrUpdateProcessor");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/insert-or-update-processor");
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 insertOrUpdateProcessorForHttpResponse(Long spaceId, PaymentAppProcessorCreationRequest 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 insertOrUpdateProcessor");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling insertOrUpdateProcessor");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/insert-or-update-processor");
// 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();
}
/**
* Update Charge Attempt
* This operation updates the state of the charge attempt. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned charge attempt corresponds to the charge attempt indicated 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 This is the ID of the space in which the charge attempt is located in.
* @param request The charge attempt update request allows to update the state of a charge attempt.
* @return ChargeAttempt
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Charge Attempt Documentation
**/
public ChargeAttempt updateChargeAttempt(Long spaceId, PaymentAppChargeAttemptUpdateRequest request) throws IOException {
HttpResponse response = updateChargeAttemptForHttpResponse(spaceId, request);
String returnType = "ChargeAttempt";
if(returnType.equals("String")){
return (ChargeAttempt) (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 (ChargeAttempt)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Update Charge Attempt
* This operation updates the state of the charge attempt. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned charge attempt corresponds to the charge attempt indicated 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 This is the ID of the space in which the charge attempt is located in.
* @param request The charge attempt update request allows to update the state of a charge attempt.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return ChargeAttempt
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Charge Attempt Documentation
**/
public ChargeAttempt updateChargeAttempt(Long spaceId, PaymentAppChargeAttemptUpdateRequest request, Map params) throws IOException {
HttpResponse response = updateChargeAttemptForHttpResponse(spaceId, request, params);
String returnType = "ChargeAttempt";
if(returnType.equals("String")){
return (ChargeAttempt) (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 (ChargeAttempt)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse updateChargeAttemptForHttpResponse(Long spaceId, PaymentAppChargeAttemptUpdateRequest request) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling updateChargeAttempt");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateChargeAttempt");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-charge-attempt");
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 updateChargeAttemptForHttpResponse(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 updateChargeAttempt");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateChargeAttempt");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-charge-attempt");
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 updateChargeAttemptForHttpResponse(Long spaceId, PaymentAppChargeAttemptUpdateRequest 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 updateChargeAttempt");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateChargeAttempt");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-charge-attempt");
// 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();
}
/**
* Update Completion
* This operation updates the state of the transaction completion. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned completion corresponds to the completion indicated 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 This is the ID of the space in which the completion is located in.
* @param request The completion update request allows to update the state of a completion.
* @return TransactionCompletion
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Completion Documentation
**/
public TransactionCompletion updateCompletion(Long spaceId, PaymentAppCompletionUpdateRequest request) throws IOException {
HttpResponse response = updateCompletionForHttpResponse(spaceId, request);
String returnType = "TransactionCompletion";
if(returnType.equals("String")){
return (TransactionCompletion) (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 (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Update Completion
* This operation updates the state of the transaction completion. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned completion corresponds to the completion indicated 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 This is the ID of the space in which the completion is located in.
* @param request The completion update request allows to update the state of a completion.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return TransactionCompletion
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Completion Documentation
**/
public TransactionCompletion updateCompletion(Long spaceId, PaymentAppCompletionUpdateRequest request, Map params) throws IOException {
HttpResponse response = updateCompletionForHttpResponse(spaceId, request, params);
String returnType = "TransactionCompletion";
if(returnType.equals("String")){
return (TransactionCompletion) (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 (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse updateCompletionForHttpResponse(Long spaceId, PaymentAppCompletionUpdateRequest request) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling updateCompletion");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateCompletion");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-completion");
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 updateCompletionForHttpResponse(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 updateCompletion");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateCompletion");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-completion");
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 updateCompletionForHttpResponse(Long spaceId, PaymentAppCompletionUpdateRequest 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 updateCompletion");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateCompletion");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-completion");
// 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();
}
/**
* Update Refund
* This operation updates the state of the refund. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned refund corresponds to the refund indicated 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 This is the ID of the space in which the refund is located in.
* @param request The refund update request allows to update the state of a refund.
* @return Refund
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Refund Documentation
**/
public Refund updateRefund(Long spaceId, PaymentAppRefundUpdateRequest request) throws IOException {
HttpResponse response = updateRefundForHttpResponse(spaceId, request);
String returnType = "Refund";
if(returnType.equals("String")){
return (Refund) (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 (Refund)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Update Refund
* This operation updates the state of the refund. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned refund corresponds to the refund indicated 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 This is the ID of the space in which the refund is located in.
* @param request The refund update request allows to update the state of a refund.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Refund
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Refund Documentation
**/
public Refund updateRefund(Long spaceId, PaymentAppRefundUpdateRequest request, Map params) throws IOException {
HttpResponse response = updateRefundForHttpResponse(spaceId, request, params);
String returnType = "Refund";
if(returnType.equals("String")){
return (Refund) (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 (Refund)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse updateRefundForHttpResponse(Long spaceId, PaymentAppRefundUpdateRequest request) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling updateRefund");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateRefund");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-refund");
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 updateRefundForHttpResponse(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 updateRefund");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateRefund");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-refund");
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 updateRefundForHttpResponse(Long spaceId, PaymentAppRefundUpdateRequest 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 updateRefund");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateRefund");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-refund");
// 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();
}
/**
* Update Void
* This operation updates the state of the transaction void. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned void corresponds to the void indicated 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 This is the ID of the space in which the void is located in.
* @param request The void update request allows to update the state of a void.
* @return TransactionVoid
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Void Documentation
**/
public TransactionVoid updateVoid(Long spaceId, PaymentAppVoidUpdateRequest request) throws IOException {
HttpResponse response = updateVoidForHttpResponse(spaceId, request);
String returnType = "TransactionVoid";
if(returnType.equals("String")){
return (TransactionVoid) (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 (TransactionVoid)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Update Void
* This operation updates the state of the transaction void. This method can be invoked for transactions originally created with a processor associated with the web app that invokes this operation. The returned void corresponds to the void indicated 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 This is the ID of the space in which the void is located in.
* @param request The void update request allows to update the state of a void.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return TransactionVoid
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Void Documentation
**/
public TransactionVoid updateVoid(Long spaceId, PaymentAppVoidUpdateRequest request, Map params) throws IOException {
HttpResponse response = updateVoidForHttpResponse(spaceId, request, params);
String returnType = "TransactionVoid";
if(returnType.equals("String")){
return (TransactionVoid) (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 (TransactionVoid)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse updateVoidForHttpResponse(Long spaceId, PaymentAppVoidUpdateRequest request) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling updateVoid");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateVoid");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-void");
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 updateVoidForHttpResponse(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 updateVoid");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateVoid");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-void");
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 updateVoidForHttpResponse(Long spaceId, PaymentAppVoidUpdateRequest 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 updateVoid");
}
// verify the required parameter 'request' is set
if (request == null) {
throw new IllegalArgumentException("Missing the required parameter 'request' when calling updateVoid");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/payment-web-app/update-void");
// 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();
}
private boolean isNoBodyResponse(HttpResponse response) throws IOException {
java.io.InputStream content = response.getContent();
return content.available() == 0;
}
}