
Api.PaymentLinksApi 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 Model.CreatePaymentLinkRequest;
import Model.InvoicingV2InvoicesAllGet502Response;
import Model.PblPaymentLinksAllGet200Response;
import Model.PblPaymentLinksAllGet400Response;
import Model.PblPaymentLinksAllGet404Response;
import Model.PblPaymentLinksGet200Response;
import Model.PblPaymentLinksPost201Response;
import Model.UpdatePaymentLinkRequest;
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;
import com.cybersource.authsdk.util.mle.MLEUtility;
import com.cybersource.authsdk.util.mle.MLEException;
public class PaymentLinksApi {
private static Logger logger = LogManager.getLogger(PaymentLinksApi.class);
private ApiClient apiClient;
public PaymentLinksApi() {
this(Configuration.getDefaultApiClient());
}
public PaymentLinksApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for createPaymentLink
* @param createPaymentLinkRequest (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 createPaymentLinkCall(CreatePaymentLinkRequest createPaymentLinkRequest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = sdkTracker.insertDeveloperIdTracker(createPaymentLinkRequest, CreatePaymentLinkRequest.class.getSimpleName(), apiClient.merchantConfig.getRunEnvironment(), apiClient.merchantConfig.getDefaultDeveloperId());
boolean isMLESupportedByCybsForApi = false;
if (MLEUtility.checkIsMLEForAPI(apiClient.merchantConfig, isMLESupportedByCybsForApi, "createPaymentLink,createPaymentLinkAsync,createPaymentLinkWithHttpInfo,createPaymentLinkCall")) {
try {
localVarPostBody = MLEUtility.encryptRequestPayload(apiClient.merchantConfig, localVarPostBody);
} catch (MLEException e) {
logger.error("Failed to encrypt request body {}", e.getMessage(), e);
throw new ApiException("Failed to encrypt request body : " + e.getMessage());
}
}
// create path and map variables
String localVarPath = "/ipl/v2/payment-links";
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "application/hal+json", "application/json;charset=utf-8", "application/hal+json;charset=utf-8"
};
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, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createPaymentLinkValidateBeforeCall(CreatePaymentLinkRequest createPaymentLinkRequest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'createPaymentLinkRequest' is set
if (createPaymentLinkRequest == null) {
logger.error("Missing the required parameter 'createPaymentLinkRequest' when calling createPaymentLink(Async)");
throw new ApiException("Missing the required parameter 'createPaymentLinkRequest' when calling createPaymentLink(Async)");
}
okhttp3.Call call = createPaymentLinkCall(createPaymentLinkRequest, progressListener, progressRequestListener);
return call;
}
/**
* Create a Payment Link
* Create a new payment link.
* @param createPaymentLinkRequest (required)
* @return PblPaymentLinksPost201Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public PblPaymentLinksPost201Response createPaymentLink(CreatePaymentLinkRequest createPaymentLinkRequest) throws ApiException {
logger.info("CALL TO METHOD 'createPaymentLink' STARTED");
ApiResponse resp = createPaymentLinkWithHttpInfo(createPaymentLinkRequest);
logger.info("CALL TO METHOD 'createPaymentLink' ENDED");
return resp.getData();
}
/**
* Create a Payment Link
* Create a new payment link.
* @param createPaymentLinkRequest (required)
* @return ApiResponse<PblPaymentLinksPost201Response>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse createPaymentLinkWithHttpInfo(CreatePaymentLinkRequest createPaymentLinkRequest) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
okhttp3.Call call = createPaymentLinkValidateBeforeCall(createPaymentLinkRequest, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Create a Payment Link (asynchronously)
* Create a new payment link.
* @param createPaymentLinkRequest (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 createPaymentLinkAsync(CreatePaymentLinkRequest createPaymentLinkRequest, 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 = createPaymentLinkValidateBeforeCall(createPaymentLinkRequest, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getAllPaymentLinks
* @param offset Page offset number. (required)
* @param limit Maximum number of items you would like returned. Maximum limit: 1000 (required)
* @param status The status of the purchase or donation link. Possible values: - ACTIVE - INACTIVE (optional)
* @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 getAllPaymentLinksCall(Integer offset, Integer limit, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = null;
if ("GET".equalsIgnoreCase("POST")) {
localVarPostBody = "{}";
}
boolean isMLESupportedByCybsForApi = false;
if (MLEUtility.checkIsMLEForAPI(apiClient.merchantConfig, isMLESupportedByCybsForApi, "getAllPaymentLinks,getAllPaymentLinksAsync,getAllPaymentLinksWithHttpInfo,getAllPaymentLinksCall")) {
try {
localVarPostBody = MLEUtility.encryptRequestPayload(apiClient.merchantConfig, localVarPostBody);
} catch (MLEException e) {
logger.error("Failed to encrypt request body {}", e.getMessage(), e);
throw new ApiException("Failed to encrypt request body : " + e.getMessage());
}
}
// create path and map variables
String localVarPath = "/ipl/v2/payment-links";
List localVarQueryParams = new ArrayList();
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
if (status != null)
localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", status));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "application/hal+json", "application/json;charset=utf-8", "application/hal+json;charset=utf-8"
};
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 getAllPaymentLinksValidateBeforeCall(Integer offset, Integer limit, String status, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'offset' is set
if (offset == null) {
logger.error("Missing the required parameter 'offset' when calling getAllPaymentLinks(Async)");
throw new ApiException("Missing the required parameter 'offset' when calling getAllPaymentLinks(Async)");
}
// verify the required parameter 'limit' is set
if (limit == null) {
logger.error("Missing the required parameter 'limit' when calling getAllPaymentLinks(Async)");
throw new ApiException("Missing the required parameter 'limit' when calling getAllPaymentLinks(Async)");
}
okhttp3.Call call = getAllPaymentLinksCall(offset, limit, status, progressListener, progressRequestListener);
return call;
}
/**
* Get a List of Payment Links
* Provides a (filtered) list of payment links that have been created in your account. You can filter the list based on the following status types: - ACTIVE - INACTIVE
* @param offset Page offset number. (required)
* @param limit Maximum number of items you would like returned. Maximum limit: 1000 (required)
* @param status The status of the purchase or donation link. Possible values: - ACTIVE - INACTIVE (optional)
* @return PblPaymentLinksAllGet200Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public PblPaymentLinksAllGet200Response getAllPaymentLinks(Integer offset, Integer limit, String status) throws ApiException {
logger.info("CALL TO METHOD 'getAllPaymentLinks' STARTED");
ApiResponse resp = getAllPaymentLinksWithHttpInfo(offset, limit, status);
logger.info("CALL TO METHOD 'getAllPaymentLinks' ENDED");
return resp.getData();
}
/**
* Get a List of Payment Links
* Provides a (filtered) list of payment links that have been created in your account. You can filter the list based on the following status types: - ACTIVE - INACTIVE
* @param offset Page offset number. (required)
* @param limit Maximum number of items you would like returned. Maximum limit: 1000 (required)
* @param status The status of the purchase or donation link. Possible values: - ACTIVE - INACTIVE (optional)
* @return ApiResponse<PblPaymentLinksAllGet200Response>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getAllPaymentLinksWithHttpInfo(Integer offset, Integer limit, String status) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
okhttp3.Call call = getAllPaymentLinksValidateBeforeCall(offset, limit, status, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get a List of Payment Links (asynchronously)
* Provides a (filtered) list of payment links that have been created in your account. You can filter the list based on the following status types: - ACTIVE - INACTIVE
* @param offset Page offset number. (required)
* @param limit Maximum number of items you would like returned. Maximum limit: 1000 (required)
* @param status The status of the purchase or donation link. Possible values: - ACTIVE - INACTIVE (optional)
* @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 getAllPaymentLinksAsync(Integer offset, Integer limit, String status, 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 = getAllPaymentLinksValidateBeforeCall(offset, limit, status, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getPaymentLink
* @param id The purchase number. (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 getPaymentLinkCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = null;
if ("GET".equalsIgnoreCase("POST")) {
localVarPostBody = "{}";
}
boolean isMLESupportedByCybsForApi = false;
if (MLEUtility.checkIsMLEForAPI(apiClient.merchantConfig, isMLESupportedByCybsForApi, "getPaymentLink,getPaymentLinkAsync,getPaymentLinkWithHttpInfo,getPaymentLinkCall")) {
try {
localVarPostBody = MLEUtility.encryptRequestPayload(apiClient.merchantConfig, localVarPostBody);
} catch (MLEException e) {
logger.error("Failed to encrypt request body {}", e.getMessage(), e);
throw new ApiException("Failed to encrypt request body : " + e.getMessage());
}
}
// create path and map variables
String localVarPath = "/ipl/v2/payment-links/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "application/hal+json", "application/json;charset=utf-8", "application/hal+json;charset=utf-8"
};
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 getPaymentLinkValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
logger.error("Missing the required parameter 'id' when calling getPaymentLink(Async)");
throw new ApiException("Missing the required parameter 'id' when calling getPaymentLink(Async)");
}
okhttp3.Call call = getPaymentLinkCall(id, progressListener, progressRequestListener);
return call;
}
/**
* Get Payment Link Details
* You can retrieve details of a specific payment link. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.
* @param id The purchase number. (required)
* @return PblPaymentLinksGet200Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public PblPaymentLinksGet200Response getPaymentLink(String id) throws ApiException {
logger.info("CALL TO METHOD 'getPaymentLink' STARTED");
ApiResponse resp = getPaymentLinkWithHttpInfo(id);
logger.info("CALL TO METHOD 'getPaymentLink' ENDED");
return resp.getData();
}
/**
* Get Payment Link Details
* You can retrieve details of a specific payment link. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.
* @param id The purchase number. (required)
* @return ApiResponse<PblPaymentLinksGet200Response>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getPaymentLinkWithHttpInfo(String id) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
okhttp3.Call call = getPaymentLinkValidateBeforeCall(id, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Get Payment Link Details (asynchronously)
* You can retrieve details of a specific payment link. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.
* @param id The purchase number. (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 getPaymentLinkAsync(String id, 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 = getPaymentLinkValidateBeforeCall(id, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for updatePaymentLink
* @param id The purchase number. (required)
* @param updatePaymentLinkRequest Updating the purchase or donation link does not resend the link automatically. You must resend the purchase or donation link separately. (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 updatePaymentLinkCall(String id, UpdatePaymentLinkRequest updatePaymentLinkRequest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
SdkTracker sdkTracker = new SdkTracker();
Object localVarPostBody = sdkTracker.insertDeveloperIdTracker(updatePaymentLinkRequest, UpdatePaymentLinkRequest.class.getSimpleName(), apiClient.merchantConfig.getRunEnvironment(), apiClient.merchantConfig.getDefaultDeveloperId());
boolean isMLESupportedByCybsForApi = false;
if (MLEUtility.checkIsMLEForAPI(apiClient.merchantConfig, isMLESupportedByCybsForApi, "updatePaymentLink,updatePaymentLinkAsync,updatePaymentLinkWithHttpInfo,updatePaymentLinkCall")) {
try {
localVarPostBody = MLEUtility.encryptRequestPayload(apiClient.merchantConfig, localVarPostBody);
} catch (MLEException e) {
logger.error("Failed to encrypt request body {}", e.getMessage(), e);
throw new ApiException("Failed to encrypt request body : " + e.getMessage());
}
}
// create path and map variables
String localVarPath = "/ipl/v2/payment-links/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "application/hal+json", "application/json;charset=utf-8", "application/hal+json;charset=utf-8"
};
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, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call updatePaymentLinkValidateBeforeCall(String id, UpdatePaymentLinkRequest updatePaymentLinkRequest, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
logger.error("Missing the required parameter 'id' when calling updatePaymentLink(Async)");
throw new ApiException("Missing the required parameter 'id' when calling updatePaymentLink(Async)");
}
// verify the required parameter 'updatePaymentLinkRequest' is set
if (updatePaymentLinkRequest == null) {
logger.error("Missing the required parameter 'updatePaymentLinkRequest' when calling updatePaymentLink(Async)");
throw new ApiException("Missing the required parameter 'updatePaymentLinkRequest' when calling updatePaymentLink(Async)");
}
okhttp3.Call call = updatePaymentLinkCall(id, updatePaymentLinkRequest, progressListener, progressRequestListener);
return call;
}
/**
* Update a Payment Link
* You can update all information except the payment link number until any payment is received for a payment link.
* @param id The purchase number. (required)
* @param updatePaymentLinkRequest Updating the purchase or donation link does not resend the link automatically. You must resend the purchase or donation link separately. (required)
* @return PblPaymentLinksPost201Response
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public PblPaymentLinksPost201Response updatePaymentLink(String id, UpdatePaymentLinkRequest updatePaymentLinkRequest) throws ApiException {
logger.info("CALL TO METHOD 'updatePaymentLink' STARTED");
ApiResponse resp = updatePaymentLinkWithHttpInfo(id, updatePaymentLinkRequest);
logger.info("CALL TO METHOD 'updatePaymentLink' ENDED");
return resp.getData();
}
/**
* Update a Payment Link
* You can update all information except the payment link number until any payment is received for a payment link.
* @param id The purchase number. (required)
* @param updatePaymentLinkRequest Updating the purchase or donation link does not resend the link automatically. You must resend the purchase or donation link separately. (required)
* @return ApiResponse<PblPaymentLinksPost201Response>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse updatePaymentLinkWithHttpInfo(String id, UpdatePaymentLinkRequest updatePaymentLinkRequest) throws ApiException {
this.apiClient.setComputationStartTime(System.nanoTime());
okhttp3.Call call = updatePaymentLinkValidateBeforeCall(id, updatePaymentLinkRequest, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Update a Payment Link (asynchronously)
* You can update all information except the payment link number until any payment is received for a payment link.
* @param id The purchase number. (required)
* @param updatePaymentLinkRequest Updating the purchase or donation link does not resend the link automatically. You must resend the purchase or donation link separately. (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 updatePaymentLinkAsync(String id, UpdatePaymentLinkRequest updatePaymentLinkRequest, 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 = updatePaymentLinkValidateBeforeCall(id, updatePaymentLinkRequest, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy