
Api.TransientTokenDataApi Maven / Gradle / Ivy
/*
* CyberSource Merged Spec
* All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
*
* OpenAPI spec version: 0.0.1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package Api;
import Invokers.ApiCallback;
import Invokers.ApiClient;
import Invokers.ApiException;
import Invokers.ApiResponse;
import Invokers.Configuration;
import Invokers.Pair;
import Invokers.ProgressRequestBody;
import Invokers.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import utilities.tracking.SdkTracker;
public class TransientTokenDataApi {
private static Logger logger = LogManager.getLogger(TransientTokenDataApi.class);
private ApiClient apiClient;
public TransientTokenDataApi() {
this(Configuration.getDefaultApiClient());
}
public TransientTokenDataApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for getPaymentCredentialsForTransientToken
* @param paymentCredentialsReference The paymentCredentialsReference field contained within the Transient token returned from a successful Unified Checkout transaction (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getPaymentCredentialsForTransientTokenCall(String paymentCredentialsReference, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = null;
if ("GET".equalsIgnoreCase("POST")) {
localVarPostBody = "{}";
}
// create path and map variables
String localVarPath = "/flex/v2/payment-credentials/{paymentCredentialsReference}"
.replaceAll("\\{" + "paymentCredentialsReference" + "\\}", apiClient.escapeString(paymentCredentialsReference.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json;charset=utf-8"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getPaymentCredentialsForTransientTokenValidateBeforeCall(String paymentCredentialsReference, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'paymentCredentialsReference' is set
if (paymentCredentialsReference == null) {
logger.error("Missing the required parameter 'paymentCredentialsReference' when calling getPaymentCredentialsForTransientToken(Async)");
throw new ApiException("Missing the required parameter 'paymentCredentialsReference' when calling getPaymentCredentialsForTransientToken(Async)");
}
okhttp3.Call call = getPaymentCredentialsForTransientTokenCall(paymentCredentialsReference, progressListener, progressRequestListener);
return call;
}
/**
* Get Payment Credentials
* Retrieve the Payment data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will return PCI payment data captured by the Unified Checkout platform.
* @param paymentCredentialsReference The paymentCredentialsReference field contained within the Transient token returned from a successful Unified Checkout transaction (required)
* @return String
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public String getPaymentCredentialsForTransientToken(String paymentCredentialsReference) throws ApiException {
logger.info("CALL TO METHOD 'getPaymentCredentialsForTransientToken' STARTED");
this.apiClient.setComputationStartTime(System.nanoTime());
ApiResponse resp = getPaymentCredentialsForTransientTokenWithHttpInfo(paymentCredentialsReference);
logger.info("CALL TO METHOD 'getPaymentCredentialsForTransientToken' ENDED");
return resp.getData();
}
/**
* Get Payment Credentials
* Retrieve the Payment data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will return PCI payment data captured by the Unified Checkout platform.
* @param paymentCredentialsReference The paymentCredentialsReference field contained within the Transient token returned from a successful Unified Checkout transaction (required)
* @return ApiResponse<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getPaymentCredentialsForTransientTokenWithHttpInfo(String paymentCredentialsReference) throws ApiException {
okhttp3.Call call = getPaymentCredentialsForTransientTokenValidateBeforeCall(paymentCredentialsReference, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get Payment Credentials (asynchronously)
* Retrieve the Payment data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will return PCI payment data captured by the Unified Checkout platform.
* @param paymentCredentialsReference The paymentCredentialsReference field contained within the Transient token returned from a successful Unified Checkout transaction (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getPaymentCredentialsForTransientTokenAsync(String paymentCredentialsReference, final ApiCallback callback) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getPaymentCredentialsForTransientTokenValidateBeforeCall(paymentCredentialsReference, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getTransactionForTransientToken
* @param transientToken Transient Token returned by the Unified Checkout application. (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public okhttp3.Call getTransactionForTransientTokenCall(String transientToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = null;
if ("GET".equalsIgnoreCase("POST")) {
localVarPostBody = "{}";
}
// create path and map variables
String localVarPath = "/up/v1/payment-details/{transientToken}"
.replaceAll("\\{" + "transientToken" + "\\}", apiClient.escapeString(transientToken.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json;charset=utf-8"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().newBuilder().addNetworkInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getTransactionForTransientTokenValidateBeforeCall(String transientToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'transientToken' is set
if (transientToken == null) {
logger.error("Missing the required parameter 'transientToken' when calling getTransactionForTransientToken(Async)");
throw new ApiException("Missing the required parameter 'transientToken' when calling getTransactionForTransientToken(Async)");
}
okhttp3.Call call = getTransactionForTransientTokenCall(transientToken, progressListener, progressRequestListener);
return call;
}
/**
* Get Transient Token Data
* Retrieve the data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details.
* @param transientToken Transient Token returned by the Unified Checkout application. (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void getTransactionForTransientToken(String transientToken) throws ApiException {
logger.info("CALL TO METHOD 'getTransactionForTransientToken' STARTED");
this.apiClient.setComputationStartTime(System.nanoTime());
getTransactionForTransientTokenWithHttpInfo(transientToken);
}
/**
* Get Transient Token Data
* Retrieve the data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details.
* @param transientToken Transient Token returned by the Unified Checkout application. (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getTransactionForTransientTokenWithHttpInfo(String transientToken) throws ApiException {
okhttp3.Call call = getTransactionForTransientTokenValidateBeforeCall(transientToken, null, null);
return apiClient.execute(call);
}
/**
* Get Transient Token Data (asynchronously)
* Retrieve the data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details.
* @param transientToken Transient Token returned by the Unified Checkout application. (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public okhttp3.Call getTransactionForTransientTokenAsync(String transientToken, final ApiCallback callback) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
okhttp3.Call call = getTransactionForTransientTokenValidateBeforeCall(transientToken, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy