Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Quickstart API Reference
* Zuora Quickstart API is the API that helps you achieve fundamental use cases.
* It provides a much simplified object model and improved performance, enabling developers to easily learn and use.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiCallback;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Headers;
import org.openapitools.client.model.ListQueryParams;
import org.openapitools.client.model.GetByIdQueryParams;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import org.openapitools.client.ProgressRequestBody;
import org.openapitools.client.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.math.BigDecimal;
import org.openapitools.client.model.ErrorResponse;
import org.openapitools.client.model.Payment;
import org.openapitools.client.model.PaymentApplyUnapplyRequest;
import org.openapitools.client.model.PaymentCreateRequest;
import org.openapitools.client.model.PaymentListResponse;
import org.openapitools.client.model.PaymentPatchRequest;
import org.openapitools.client.model.ErrorResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PaymentsApi {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public PaymentsApi() {
this(Configuration.getDefaultApiClient());
}
public PaymentsApi(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public ApiClient getApiClient() {
return localVarApiClient;
}
public void setApiClient(ApiClient apiClient) {
this.localVarApiClient = apiClient;
}
public int getHostIndex() {
return localHostIndex;
}
public void setHostIndex(int hostIndex) {
this.localHostIndex = hostIndex;
}
public String getCustomBaseUrl() {
return localCustomBaseUrl;
}
public void setCustomBaseUrl(String customBaseUrl) {
this.localCustomBaseUrl = customBaseUrl;
}
private okhttp3.Call applyPaymentCall(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = paymentApplyUnapplyRequest;
// create path and map variables
String localVarPath = "/payments/{payment_id}/apply"
.replace("{" + "payment_id" + "}", localVarApiClient.escapeString(paymentId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (fields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "fields[]", fields));
}
if (paymentFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment.fields[]", paymentFields));
}
if (accountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "account.fields[]", accountFields));
}
if (paymentMethodFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_method.fields[]", paymentMethodFields));
}
if (paymentAppliedToFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to.fields[]", paymentAppliedToFields));
}
if (paymentAppliedToItemsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to_items.fields[]", paymentAppliedToItemsFields));
}
if (expand != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "expand[]", expand));
}
if (filter != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "filter[]", filter));
}
if (pageSize != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize));
}
if (zuoraTrackId != null) {
localVarHeaderParams.put("zuora-track-id", localVarApiClient.parameterToString(zuoraTrackId));
}
if (async != null) {
localVarHeaderParams.put("async", localVarApiClient.parameterToString(async));
}
if (zuoraCacheEnabled != null) {
localVarHeaderParams.put("zuora-cache-enabled", localVarApiClient.parameterToString(zuoraCacheEnabled));
}
if (zuoraEntityIds != null) {
localVarHeaderParams.put("zuora-entity-ids", localVarApiClient.parameterToString(zuoraEntityIds));
}
if (idempotencyKey != null) {
localVarHeaderParams.put("idempotency-key", localVarApiClient.parameterToString(idempotencyKey));
}
if (acceptEncoding != null) {
localVarHeaderParams.put("accept-encoding", localVarApiClient.parameterToString(acceptEncoding));
}
if (contentEncoding != null) {
localVarHeaderParams.put("content-encoding", localVarApiClient.parameterToString(contentEncoding));
}
if (zuoraOrgIds != null) {
localVarHeaderParams.put("zuora-org-ids", localVarApiClient.parameterToString(zuoraOrgIds));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "bearerAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call applyPaymentValidateBeforeCall(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException("Missing the required parameter 'paymentId' when calling applyPayment(Async)");
}
// verify the required parameter 'paymentApplyUnapplyRequest' is set
if (paymentApplyUnapplyRequest == null) {
throw new ApiException("Missing the required parameter 'paymentApplyUnapplyRequest' when calling applyPayment(Async)");
}
return applyPaymentCall(paymentId, paymentApplyUnapplyRequest, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
}
private ApiResponse applyPaymentWithHttpInfo(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds) throws ApiException {
okhttp3.Call localVarCall = applyPaymentValidateBeforeCall(paymentId, paymentApplyUnapplyRequest, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
throw e;
}
}
private okhttp3.Call applyPaymentAsync(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = applyPaymentValidateBeforeCall(paymentId, paymentApplyUnapplyRequest, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public static class ApplyPaymentParams {
private final String paymentId;
private final PaymentApplyUnapplyRequest paymentApplyUnapplyRequest;
private Headers headers;
/*
* Check for list params
*/
private GetByIdQueryParams getByIdQueryParams;
private List fields;
private List paymentFields;
private List accountFields;
private List paymentMethodFields;
private List paymentAppliedToFields;
private List paymentAppliedToItemsFields;
private List expand;
private List filter;
private Integer pageSize;
private String zuoraTrackId;
private Boolean async;
private Boolean zuoraCacheEnabled;
private String zuoraEntityIds;
private String idempotencyKey;
private String acceptEncoding;
private String contentEncoding;
private String zuoraOrgIds;
public ApplyPaymentParams(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest) {
this.paymentId = paymentId;
this.paymentApplyUnapplyRequest = paymentApplyUnapplyRequest;
}
/**
* Set getByIdQueryParams
* @param getByIdQueryParams GetByIdQueryParams
* @return ApplyPaymentParams
*/
public ApplyPaymentParams getByIdQueryParams(GetByIdQueryParams getByIdQueryParams) {
this.getByIdQueryParams = getByIdQueryParams;
if (expand != null) {
this.expand = getByIdQueryParams.getExpand();
}
if (filter != null) {
this.filter = getByIdQueryParams.getFilter();
}
if (pageSize != null) {
this.pageSize = getByIdQueryParams.getPageSize();
}
return this;
}
/**
* Set headers
* @param headers Headers
* @return ApplyPaymentParams
*/
public ApplyPaymentParams headers(Headers headers) {
this.headers = headers;
if (headers.getZuoraTrackId() != null) {
this.zuoraTrackId = headers.getZuoraTrackId();
}
if (headers.getAsync() != null) {
this.async = headers.getAsync();
}
if (headers.getZuoraCacheEnabled() != null) {
this.zuoraCacheEnabled = headers.getZuoraCacheEnabled();
}
if (headers.getZuoraEntityIds() != null) {
this.zuoraEntityIds = headers.getZuoraEntityIds();
}
if (headers.getIdempotencyKey() != null) {
this.idempotencyKey = headers.getIdempotencyKey();
}
if (headers.getAcceptEncoding() != null) {
this.acceptEncoding = headers.getAcceptEncoding();
}
if (headers.getContentEncoding() != null) {
this.contentEncoding = headers.getContentEncoding();
}
if (headers.getZuoraOrgIds() != null) {
this.zuoraOrgIds = headers.getZuoraOrgIds();
}
return this;
}
/**
* Set fields
* @param fields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `payment_number`, `payment_date`, `gateway_id`, `payment_method_id`, `payout_id`, `reference_id`, `second_reference_id`, `statement_descriptor_phone`, `state`, `statement_descriptor`, `account_id`, `amount`, `amount_applied`, `amount_refunded`, `remaining_balance`, `currency`, `description`, `authorization_id`, `external`, `gateway_order_id`, `gateway_reconciliation_status`, `gateway_reconciliation_reason`, `gateway_response`, `gateway_response_code`, `gateway_state`, `state_transitions`, `gateway_state_transitions` </details> (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams fields(List fields) {
this.fields = fields;
return this;
}
/**
* Set paymentFields
* @param paymentFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `payment_number`, `payment_date`, `gateway_id`, `payment_method_id`, `payout_id`, `reference_id`, `second_reference_id`, `statement_descriptor_phone`, `state`, `statement_descriptor`, `account_id`, `amount`, `amount_applied`, `amount_refunded`, `remaining_balance`, `currency`, `description`, `authorization_id`, `external`, `gateway_order_id`, `gateway_reconciliation_status`, `gateway_reconciliation_reason`, `gateway_response`, `gateway_response_code`, `gateway_state`, `state_transitions`, `gateway_state_transitions` </details> (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams paymentFields(List paymentFields) {
this.paymentFields = paymentFields;
return this;
}
/**
* Set accountFields
* @param accountFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `auto_pay`, `account_number`, `bill_to_id`, `sold_to_id`, `billing_document_settings`, `communication_profile_id`, `crm_id`, `sales_rep`, `parent_account_id`, `payment_gateway`, `payment_terms`, `remaining_credit_memo_balance`, `remaining_debit_memo_balance`, `remaining_invoice_balance`, `remaining_payment_balance`, `sequence_set_id`, `tax_certificate`, `batch`, `tax_identifier`, `bill_cycle_day`, `description`, `name`, `currency`, `default_payment_method_id`, `enabled`, `organization_id` </details> (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams accountFields(List accountFields) {
this.accountFields = accountFields;
return this;
}
/**
* Set paymentMethodFields
* @param paymentMethodFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `type`, `account_id`, `bank_identification_number`, `device_session_id`, `ip_address`, `maximum_payment_attempts`, `payment_retry_interval`, `state`, `use_default_retry_rule`, `existing_mandate`, `last_failed_sale_transaction_time`, `last_transaction_time`, `last_transaction_status`, `number_of_consecutive_failures`, `total_number_of_processed_payments`, `total_number_of_error_payments`, `billing_details`, `card`, `apple_pay`, `google_pay`, `ach_debit`, `cc_ref`, `paypal_adaptive`, `paypal_express_native`, `paypal_express`, `sepa_debit`, `betalings_debit`, `autogiro_debit`, `bacs_debit`, `au_becs_debit`, `nz_becs_debit`, `pad_debit` </details> (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams paymentMethodFields(List paymentMethodFields) {
this.paymentMethodFields = paymentMethodFields;
return this;
}
/**
* Set paymentAppliedToFields
* @param paymentAppliedToFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `amount`, `billing_document_id`, `billing_document_type`, `id`, `state` </details> (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams paymentAppliedToFields(List paymentAppliedToFields) {
this.paymentAppliedToFields = paymentAppliedToFields;
return this;
}
/**
* Set paymentAppliedToItemsFields
* @param paymentAppliedToItemsFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `id`, `amount`, `billing_document_item_id` </details> (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams paymentAppliedToItemsFields(List paymentAppliedToItemsFields) {
this.paymentAppliedToItemsFields = paymentAppliedToItemsFields;
return this;
}
/**
* Set expand
* @param expand Allows you to expand responses by including related object information in a single call. See the [Expand responses](https://developer.zuora.com/quickstart-api/tutorial/expand-responses/) section of the Quickstart API Tutorials for detailed instructions. (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams expand(List expand) {
this.expand = expand;
return this;
}
/**
* Set filter
* @param filter A case-sensitive filter on the list. See the [Filter lists](https://developer.zuora.com/quickstart-api/tutorial/filter-lists/) section of the Quickstart API Tutorial for detailed instructions. Note that the filters on this operation are only applicable to the related objects. For example, when you are calling the \"Retrieve a billing document\" operation, you can use the `filter[]` parameter on the related objects such as `filter[]=items[account_id].EQ:8ad09e208858b5cf0188595208151c63` (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams filter(List filter) {
this.filter = filter;
return this;
}
/**
* Set pageSize
* @param pageSize The maximum number of results to return in a single page. If the specified `page_size` is less than 1 or greater than 99, Zuora will return a 400 error. (optional)
* @return ApplyPaymentParams
*/
public ApplyPaymentParams pageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
}
/**
* Apply a payment
* Applies a payment to one or more invoices or debit memos.
* @param paymentId Identifier for the payment, either `payment_number` or `payment_id` (required)
* @param paymentApplyUnapplyRequest (required)
* @return Payment
* @http.response.details
Status Code
Description
Response Headers
200
Default Response
* ratelimit-limit - The request limit quota for the time window closest to exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-remaining - The number of requests remaining in the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-reset - The number of seconds until the quota resets for the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * zuora-request-id - Zuora’s internal identifier for this request. * zuora-track-id - A user-supplied identifier for this request. If you supply a `zuora-track-id` as a request header, Zuora returns the `zuora-track-id` as a response header.
400
Bad Request
-
401
Unauthorized
-
404
Not Found
-
405
Method Not Allowed
-
429
Too Many Requests
-
500
Internal Server Error
-
502
Bad Gateway
-
503
Service Unavailable
-
504
Gateway Timeout
-
*/
public ApplyPaymentParams applyPaymentParams(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest) {
return new ApplyPaymentParams(paymentId, paymentApplyUnapplyRequest);
}
public Payment applyPayment(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest) throws ApiException {
ApplyPaymentParams params = new ApplyPaymentParams(paymentId, paymentApplyUnapplyRequest);
return executeApplyPaymentAPICall(params).getData();
}
/**
* Expose HTTP info
public ApiResponse applyPaymentWithHttpInfo(String paymentId, PaymentApplyUnapplyRequest paymentApplyUnapplyRequest) throws ApiException {
ApplyPaymentParams params = new ApplyPaymentParams(paymentId, paymentApplyUnapplyRequest);
return executeApplyPaymentAPICall(params);
}
**/
/**
Legacy Query Params Requests
**/
public Payment applyPayment( String paymentId , PaymentApplyUnapplyRequest paymentApplyUnapplyRequest , List expand) throws ApiException {
ApplyPaymentParams params = new ApplyPaymentParams(paymentId, paymentApplyUnapplyRequest);
params.expand(expand);
return executeApplyPaymentAPICall(params).getData();
}
/*
* add header methods
*/
public Payment applyPayment(String paymentId , PaymentApplyUnapplyRequest paymentApplyUnapplyRequest ,List expand,Headers headers) throws ApiException {
ApplyPaymentParams params = new ApplyPaymentParams(paymentId, paymentApplyUnapplyRequest)
.expand(expand)
.headers(headers);
return executeApplyPaymentAPICall(params).getData();
}
/**
* Apply a payment
* Applies a payment to one or more invoices or debit memos.
* @param params ApplyPaymentParams
* @return Payment
* @http.response.details
Status Code
Description
Response Headers
200
Default Response
* ratelimit-limit - The request limit quota for the time window closest to exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-remaining - The number of requests remaining in the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-reset - The number of seconds until the quota resets for the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * zuora-request-id - Zuora’s internal identifier for this request. * zuora-track-id - A user-supplied identifier for this request. If you supply a `zuora-track-id` as a request header, Zuora returns the `zuora-track-id` as a response header.
400
Bad Request
-
401
Unauthorized
-
404
Not Found
-
405
Method Not Allowed
-
429
Too Many Requests
-
500
Internal Server Error
-
502
Bad Gateway
-
503
Service Unavailable
-
504
Gateway Timeout
-
*/
public Payment apply(ApplyPaymentParams params) throws ApiException {
return executeApplyPaymentAPICall(params).getData();
}
public ApiResponse applyWithHttpInfo(ApplyPaymentParams params) throws ApiException {
return executeApplyPaymentAPICall(params);
}
ApiResponse executeApplyPaymentAPICall(ApplyPaymentParams params) throws ApiException {
return applyPaymentWithHttpInfo(params.paymentId, params.paymentApplyUnapplyRequest, params.fields, params.paymentFields, params.accountFields, params.paymentMethodFields, params.paymentAppliedToFields, params.paymentAppliedToItemsFields, params.expand, params.filter, params.pageSize, params.zuoraTrackId, params.async, params.zuoraCacheEnabled, params.zuoraEntityIds, params.idempotencyKey, params.acceptEncoding, params.contentEncoding, params.zuoraOrgIds);
}
private okhttp3.Call cancelPaymentCall(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/payments/{payment_id}/cancel"
.replace("{" + "payment_id" + "}", localVarApiClient.escapeString(paymentId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (fields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "fields[]", fields));
}
if (paymentFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment.fields[]", paymentFields));
}
if (accountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "account.fields[]", accountFields));
}
if (paymentMethodFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_method.fields[]", paymentMethodFields));
}
if (paymentAppliedToFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to.fields[]", paymentAppliedToFields));
}
if (paymentAppliedToItemsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to_items.fields[]", paymentAppliedToItemsFields));
}
if (expand != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "expand[]", expand));
}
if (filter != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "filter[]", filter));
}
if (pageSize != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize));
}
if (zuoraTrackId != null) {
localVarHeaderParams.put("zuora-track-id", localVarApiClient.parameterToString(zuoraTrackId));
}
if (async != null) {
localVarHeaderParams.put("async", localVarApiClient.parameterToString(async));
}
if (zuoraCacheEnabled != null) {
localVarHeaderParams.put("zuora-cache-enabled", localVarApiClient.parameterToString(zuoraCacheEnabled));
}
if (zuoraEntityIds != null) {
localVarHeaderParams.put("zuora-entity-ids", localVarApiClient.parameterToString(zuoraEntityIds));
}
if (idempotencyKey != null) {
localVarHeaderParams.put("idempotency-key", localVarApiClient.parameterToString(idempotencyKey));
}
if (acceptEncoding != null) {
localVarHeaderParams.put("accept-encoding", localVarApiClient.parameterToString(acceptEncoding));
}
if (contentEncoding != null) {
localVarHeaderParams.put("content-encoding", localVarApiClient.parameterToString(contentEncoding));
}
if (zuoraOrgIds != null) {
localVarHeaderParams.put("zuora-org-ids", localVarApiClient.parameterToString(zuoraOrgIds));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "bearerAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call cancelPaymentValidateBeforeCall(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException("Missing the required parameter 'paymentId' when calling cancelPayment(Async)");
}
return cancelPaymentCall(paymentId, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
}
private ApiResponse cancelPaymentWithHttpInfo(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds) throws ApiException {
okhttp3.Call localVarCall = cancelPaymentValidateBeforeCall(paymentId, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
throw e;
}
}
private okhttp3.Call cancelPaymentAsync(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = cancelPaymentValidateBeforeCall(paymentId, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public static class CancelPaymentParams {
private final String paymentId;
private Headers headers;
/*
* Check for list params
*/
private GetByIdQueryParams getByIdQueryParams;
private List fields;
private List paymentFields;
private List accountFields;
private List paymentMethodFields;
private List paymentAppliedToFields;
private List paymentAppliedToItemsFields;
private List expand;
private List filter;
private Integer pageSize;
private String zuoraTrackId;
private Boolean async;
private Boolean zuoraCacheEnabled;
private String zuoraEntityIds;
private String idempotencyKey;
private String acceptEncoding;
private String contentEncoding;
private String zuoraOrgIds;
public CancelPaymentParams(String paymentId) {
this.paymentId = paymentId;
}
/**
* Set getByIdQueryParams
* @param getByIdQueryParams GetByIdQueryParams
* @return CancelPaymentParams
*/
public CancelPaymentParams getByIdQueryParams(GetByIdQueryParams getByIdQueryParams) {
this.getByIdQueryParams = getByIdQueryParams;
if (expand != null) {
this.expand = getByIdQueryParams.getExpand();
}
if (filter != null) {
this.filter = getByIdQueryParams.getFilter();
}
if (pageSize != null) {
this.pageSize = getByIdQueryParams.getPageSize();
}
return this;
}
/**
* Set headers
* @param headers Headers
* @return CancelPaymentParams
*/
public CancelPaymentParams headers(Headers headers) {
this.headers = headers;
if (headers.getZuoraTrackId() != null) {
this.zuoraTrackId = headers.getZuoraTrackId();
}
if (headers.getAsync() != null) {
this.async = headers.getAsync();
}
if (headers.getZuoraCacheEnabled() != null) {
this.zuoraCacheEnabled = headers.getZuoraCacheEnabled();
}
if (headers.getZuoraEntityIds() != null) {
this.zuoraEntityIds = headers.getZuoraEntityIds();
}
if (headers.getIdempotencyKey() != null) {
this.idempotencyKey = headers.getIdempotencyKey();
}
if (headers.getAcceptEncoding() != null) {
this.acceptEncoding = headers.getAcceptEncoding();
}
if (headers.getContentEncoding() != null) {
this.contentEncoding = headers.getContentEncoding();
}
if (headers.getZuoraOrgIds() != null) {
this.zuoraOrgIds = headers.getZuoraOrgIds();
}
return this;
}
/**
* Set fields
* @param fields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `payment_number`, `payment_date`, `gateway_id`, `payment_method_id`, `payout_id`, `reference_id`, `second_reference_id`, `statement_descriptor_phone`, `state`, `statement_descriptor`, `account_id`, `amount`, `amount_applied`, `amount_refunded`, `remaining_balance`, `currency`, `description`, `authorization_id`, `external`, `gateway_order_id`, `gateway_reconciliation_status`, `gateway_reconciliation_reason`, `gateway_response`, `gateway_response_code`, `gateway_state`, `state_transitions`, `gateway_state_transitions` </details> (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams fields(List fields) {
this.fields = fields;
return this;
}
/**
* Set paymentFields
* @param paymentFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `payment_number`, `payment_date`, `gateway_id`, `payment_method_id`, `payout_id`, `reference_id`, `second_reference_id`, `statement_descriptor_phone`, `state`, `statement_descriptor`, `account_id`, `amount`, `amount_applied`, `amount_refunded`, `remaining_balance`, `currency`, `description`, `authorization_id`, `external`, `gateway_order_id`, `gateway_reconciliation_status`, `gateway_reconciliation_reason`, `gateway_response`, `gateway_response_code`, `gateway_state`, `state_transitions`, `gateway_state_transitions` </details> (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams paymentFields(List paymentFields) {
this.paymentFields = paymentFields;
return this;
}
/**
* Set accountFields
* @param accountFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `auto_pay`, `account_number`, `bill_to_id`, `sold_to_id`, `billing_document_settings`, `communication_profile_id`, `crm_id`, `sales_rep`, `parent_account_id`, `payment_gateway`, `payment_terms`, `remaining_credit_memo_balance`, `remaining_debit_memo_balance`, `remaining_invoice_balance`, `remaining_payment_balance`, `sequence_set_id`, `tax_certificate`, `batch`, `tax_identifier`, `bill_cycle_day`, `description`, `name`, `currency`, `default_payment_method_id`, `enabled`, `organization_id` </details> (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams accountFields(List accountFields) {
this.accountFields = accountFields;
return this;
}
/**
* Set paymentMethodFields
* @param paymentMethodFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `type`, `account_id`, `bank_identification_number`, `device_session_id`, `ip_address`, `maximum_payment_attempts`, `payment_retry_interval`, `state`, `use_default_retry_rule`, `existing_mandate`, `last_failed_sale_transaction_time`, `last_transaction_time`, `last_transaction_status`, `number_of_consecutive_failures`, `total_number_of_processed_payments`, `total_number_of_error_payments`, `billing_details`, `card`, `apple_pay`, `google_pay`, `ach_debit`, `cc_ref`, `paypal_adaptive`, `paypal_express_native`, `paypal_express`, `sepa_debit`, `betalings_debit`, `autogiro_debit`, `bacs_debit`, `au_becs_debit`, `nz_becs_debit`, `pad_debit` </details> (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams paymentMethodFields(List paymentMethodFields) {
this.paymentMethodFields = paymentMethodFields;
return this;
}
/**
* Set paymentAppliedToFields
* @param paymentAppliedToFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `amount`, `billing_document_id`, `billing_document_type`, `id`, `state` </details> (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams paymentAppliedToFields(List paymentAppliedToFields) {
this.paymentAppliedToFields = paymentAppliedToFields;
return this;
}
/**
* Set paymentAppliedToItemsFields
* @param paymentAppliedToItemsFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `id`, `amount`, `billing_document_item_id` </details> (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams paymentAppliedToItemsFields(List paymentAppliedToItemsFields) {
this.paymentAppliedToItemsFields = paymentAppliedToItemsFields;
return this;
}
/**
* Set expand
* @param expand Allows you to expand responses by including related object information in a single call. See the [Expand responses](https://developer.zuora.com/quickstart-api/tutorial/expand-responses/) section of the Quickstart API Tutorials for detailed instructions. (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams expand(List expand) {
this.expand = expand;
return this;
}
/**
* Set filter
* @param filter A case-sensitive filter on the list. See the [Filter lists](https://developer.zuora.com/quickstart-api/tutorial/filter-lists/) section of the Quickstart API Tutorial for detailed instructions. Note that the filters on this operation are only applicable to the related objects. For example, when you are calling the \"Retrieve a billing document\" operation, you can use the `filter[]` parameter on the related objects such as `filter[]=items[account_id].EQ:8ad09e208858b5cf0188595208151c63` (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams filter(List filter) {
this.filter = filter;
return this;
}
/**
* Set pageSize
* @param pageSize The maximum number of results to return in a single page. If the specified `page_size` is less than 1 or greater than 99, Zuora will return a 400 error. (optional)
* @return CancelPaymentParams
*/
public CancelPaymentParams pageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
}
/**
* Cancel a payment
* Cancels an unapplied payment.
* @param paymentId Identifier for the payment, either `payment_number` or `payment_id` (required)
* @return Payment
* @http.response.details
Status Code
Description
Response Headers
200
Default Response
-
400
Bad Request
-
401
Unauthorized
-
404
Not Found
-
405
Method Not Allowed
-
429
Too Many Requests
-
500
Internal Server Error
-
502
Bad Gateway
-
503
Service Unavailable
-
504
Gateway Timeout
-
*/
public CancelPaymentParams cancelPaymentParams(String paymentId) {
return new CancelPaymentParams(paymentId);
}
public Payment cancelPayment(String paymentId) throws ApiException {
CancelPaymentParams params = new CancelPaymentParams(paymentId);
return executeCancelPaymentAPICall(params).getData();
}
/**
* Expose HTTP info
public ApiResponse cancelPaymentWithHttpInfo(String paymentId) throws ApiException {
CancelPaymentParams params = new CancelPaymentParams(paymentId);
return executeCancelPaymentAPICall(params);
}
**/
/**
Legacy Query Params Requests
**/
public Payment cancelPayment( String paymentId , List expand) throws ApiException {
CancelPaymentParams params = new CancelPaymentParams(paymentId);
params.expand(expand);
return executeCancelPaymentAPICall(params).getData();
}
/*
* add header methods
*/
public Payment cancelPayment(String paymentId ,List expand,Headers headers) throws ApiException {
CancelPaymentParams params = new CancelPaymentParams(paymentId)
.expand(expand)
.headers(headers);
return executeCancelPaymentAPICall(params).getData();
}
/**
* Cancel a payment
* Cancels an unapplied payment.
* @param params CancelPaymentParams
* @return Payment
* @http.response.details
Status Code
Description
Response Headers
200
Default Response
-
400
Bad Request
-
401
Unauthorized
-
404
Not Found
-
405
Method Not Allowed
-
429
Too Many Requests
-
500
Internal Server Error
-
502
Bad Gateway
-
503
Service Unavailable
-
504
Gateway Timeout
-
*/
public Payment cancel(CancelPaymentParams params) throws ApiException {
return executeCancelPaymentAPICall(params).getData();
}
public ApiResponse cancelWithHttpInfo(CancelPaymentParams params) throws ApiException {
return executeCancelPaymentAPICall(params);
}
ApiResponse executeCancelPaymentAPICall(CancelPaymentParams params) throws ApiException {
return cancelPaymentWithHttpInfo(params.paymentId, params.fields, params.paymentFields, params.accountFields, params.paymentMethodFields, params.paymentAppliedToFields, params.paymentAppliedToItemsFields, params.expand, params.filter, params.pageSize, params.zuoraTrackId, params.async, params.zuoraCacheEnabled, params.zuoraEntityIds, params.idempotencyKey, params.acceptEncoding, params.contentEncoding, params.zuoraOrgIds);
}
private okhttp3.Call createPaymentCall(PaymentCreateRequest paymentCreateRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = paymentCreateRequest;
// create path and map variables
String localVarPath = "/payments";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (fields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "fields[]", fields));
}
if (paymentFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment.fields[]", paymentFields));
}
if (accountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "account.fields[]", accountFields));
}
if (paymentMethodFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_method.fields[]", paymentMethodFields));
}
if (paymentAppliedToFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to.fields[]", paymentAppliedToFields));
}
if (paymentAppliedToItemsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to_items.fields[]", paymentAppliedToItemsFields));
}
if (expand != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "expand[]", expand));
}
if (filter != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "filter[]", filter));
}
if (pageSize != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize));
}
if (zuoraTrackId != null) {
localVarHeaderParams.put("zuora-track-id", localVarApiClient.parameterToString(zuoraTrackId));
}
if (async != null) {
localVarHeaderParams.put("async", localVarApiClient.parameterToString(async));
}
if (zuoraCacheEnabled != null) {
localVarHeaderParams.put("zuora-cache-enabled", localVarApiClient.parameterToString(zuoraCacheEnabled));
}
if (zuoraEntityIds != null) {
localVarHeaderParams.put("zuora-entity-ids", localVarApiClient.parameterToString(zuoraEntityIds));
}
if (idempotencyKey != null) {
localVarHeaderParams.put("idempotency-key", localVarApiClient.parameterToString(idempotencyKey));
}
if (acceptEncoding != null) {
localVarHeaderParams.put("accept-encoding", localVarApiClient.parameterToString(acceptEncoding));
}
if (contentEncoding != null) {
localVarHeaderParams.put("content-encoding", localVarApiClient.parameterToString(contentEncoding));
}
if (zuoraOrgIds != null) {
localVarHeaderParams.put("zuora-org-ids", localVarApiClient.parameterToString(zuoraOrgIds));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "bearerAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createPaymentValidateBeforeCall(PaymentCreateRequest paymentCreateRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'paymentCreateRequest' is set
if (paymentCreateRequest == null) {
throw new ApiException("Missing the required parameter 'paymentCreateRequest' when calling createPayment(Async)");
}
return createPaymentCall(paymentCreateRequest, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
}
private ApiResponse createPaymentWithHttpInfo(PaymentCreateRequest paymentCreateRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds) throws ApiException {
okhttp3.Call localVarCall = createPaymentValidateBeforeCall(paymentCreateRequest, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
throw e;
}
}
private okhttp3.Call createPaymentAsync(PaymentCreateRequest paymentCreateRequest, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = createPaymentValidateBeforeCall(paymentCreateRequest, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public static class CreatePaymentParams {
private final PaymentCreateRequest paymentCreateRequest;
private Headers headers;
/*
* Check for list params
*/
private GetByIdQueryParams getByIdQueryParams;
private List fields;
private List paymentFields;
private List accountFields;
private List paymentMethodFields;
private List paymentAppliedToFields;
private List paymentAppliedToItemsFields;
private List expand;
private List filter;
private Integer pageSize;
private String zuoraTrackId;
private Boolean async;
private Boolean zuoraCacheEnabled;
private String zuoraEntityIds;
private String idempotencyKey;
private String acceptEncoding;
private String contentEncoding;
private String zuoraOrgIds;
public CreatePaymentParams(PaymentCreateRequest paymentCreateRequest) {
this.paymentCreateRequest = paymentCreateRequest;
}
/**
* Set getByIdQueryParams
* @param getByIdQueryParams GetByIdQueryParams
* @return CreatePaymentParams
*/
public CreatePaymentParams getByIdQueryParams(GetByIdQueryParams getByIdQueryParams) {
this.getByIdQueryParams = getByIdQueryParams;
if (expand != null) {
this.expand = getByIdQueryParams.getExpand();
}
if (filter != null) {
this.filter = getByIdQueryParams.getFilter();
}
if (pageSize != null) {
this.pageSize = getByIdQueryParams.getPageSize();
}
return this;
}
/**
* Set headers
* @param headers Headers
* @return CreatePaymentParams
*/
public CreatePaymentParams headers(Headers headers) {
this.headers = headers;
if (headers.getZuoraTrackId() != null) {
this.zuoraTrackId = headers.getZuoraTrackId();
}
if (headers.getAsync() != null) {
this.async = headers.getAsync();
}
if (headers.getZuoraCacheEnabled() != null) {
this.zuoraCacheEnabled = headers.getZuoraCacheEnabled();
}
if (headers.getZuoraEntityIds() != null) {
this.zuoraEntityIds = headers.getZuoraEntityIds();
}
if (headers.getIdempotencyKey() != null) {
this.idempotencyKey = headers.getIdempotencyKey();
}
if (headers.getAcceptEncoding() != null) {
this.acceptEncoding = headers.getAcceptEncoding();
}
if (headers.getContentEncoding() != null) {
this.contentEncoding = headers.getContentEncoding();
}
if (headers.getZuoraOrgIds() != null) {
this.zuoraOrgIds = headers.getZuoraOrgIds();
}
return this;
}
/**
* Set fields
* @param fields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `payment_number`, `payment_date`, `gateway_id`, `payment_method_id`, `payout_id`, `reference_id`, `second_reference_id`, `statement_descriptor_phone`, `state`, `statement_descriptor`, `account_id`, `amount`, `amount_applied`, `amount_refunded`, `remaining_balance`, `currency`, `description`, `authorization_id`, `external`, `gateway_order_id`, `gateway_reconciliation_status`, `gateway_reconciliation_reason`, `gateway_response`, `gateway_response_code`, `gateway_state`, `state_transitions`, `gateway_state_transitions` </details> (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams fields(List fields) {
this.fields = fields;
return this;
}
/**
* Set paymentFields
* @param paymentFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `payment_number`, `payment_date`, `gateway_id`, `payment_method_id`, `payout_id`, `reference_id`, `second_reference_id`, `statement_descriptor_phone`, `state`, `statement_descriptor`, `account_id`, `amount`, `amount_applied`, `amount_refunded`, `remaining_balance`, `currency`, `description`, `authorization_id`, `external`, `gateway_order_id`, `gateway_reconciliation_status`, `gateway_reconciliation_reason`, `gateway_response`, `gateway_response_code`, `gateway_state`, `state_transitions`, `gateway_state_transitions` </details> (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams paymentFields(List paymentFields) {
this.paymentFields = paymentFields;
return this;
}
/**
* Set accountFields
* @param accountFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `auto_pay`, `account_number`, `bill_to_id`, `sold_to_id`, `billing_document_settings`, `communication_profile_id`, `crm_id`, `sales_rep`, `parent_account_id`, `payment_gateway`, `payment_terms`, `remaining_credit_memo_balance`, `remaining_debit_memo_balance`, `remaining_invoice_balance`, `remaining_payment_balance`, `sequence_set_id`, `tax_certificate`, `batch`, `tax_identifier`, `bill_cycle_day`, `description`, `name`, `currency`, `default_payment_method_id`, `enabled`, `organization_id` </details> (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams accountFields(List accountFields) {
this.accountFields = accountFields;
return this;
}
/**
* Set paymentMethodFields
* @param paymentMethodFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `custom_fields`, `created_by_id`, `updated_by_id`, `created_time`, `id`, `updated_time`, `type`, `account_id`, `bank_identification_number`, `device_session_id`, `ip_address`, `maximum_payment_attempts`, `payment_retry_interval`, `state`, `use_default_retry_rule`, `existing_mandate`, `last_failed_sale_transaction_time`, `last_transaction_time`, `last_transaction_status`, `number_of_consecutive_failures`, `total_number_of_processed_payments`, `total_number_of_error_payments`, `billing_details`, `card`, `apple_pay`, `google_pay`, `ach_debit`, `cc_ref`, `paypal_adaptive`, `paypal_express_native`, `paypal_express`, `sepa_debit`, `betalings_debit`, `autogiro_debit`, `bacs_debit`, `au_becs_debit`, `nz_becs_debit`, `pad_debit` </details> (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams paymentMethodFields(List paymentMethodFields) {
this.paymentMethodFields = paymentMethodFields;
return this;
}
/**
* Set paymentAppliedToFields
* @param paymentAppliedToFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `amount`, `billing_document_id`, `billing_document_type`, `id`, `state` </details> (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams paymentAppliedToFields(List paymentAppliedToFields) {
this.paymentAppliedToFields = paymentAppliedToFields;
return this;
}
/**
* Set paymentAppliedToItemsFields
* @param paymentAppliedToItemsFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `id`, `amount`, `billing_document_item_id` </details> (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams paymentAppliedToItemsFields(List paymentAppliedToItemsFields) {
this.paymentAppliedToItemsFields = paymentAppliedToItemsFields;
return this;
}
/**
* Set expand
* @param expand Allows you to expand responses by including related object information in a single call. See the [Expand responses](https://developer.zuora.com/quickstart-api/tutorial/expand-responses/) section of the Quickstart API Tutorials for detailed instructions. (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams expand(List expand) {
this.expand = expand;
return this;
}
/**
* Set filter
* @param filter A case-sensitive filter on the list. See the [Filter lists](https://developer.zuora.com/quickstart-api/tutorial/filter-lists/) section of the Quickstart API Tutorial for detailed instructions. Note that the filters on this operation are only applicable to the related objects. For example, when you are calling the \"Retrieve a billing document\" operation, you can use the `filter[]` parameter on the related objects such as `filter[]=items[account_id].EQ:8ad09e208858b5cf0188595208151c63` (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams filter(List filter) {
this.filter = filter;
return this;
}
/**
* Set pageSize
* @param pageSize The maximum number of results to return in a single page. If the specified `page_size` is less than 1 or greater than 99, Zuora will return a 400 error. (optional)
* @return CreatePaymentParams
*/
public CreatePaymentParams pageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
}
/**
* Create a payment
* Creates a new payment object.
* @param paymentCreateRequest (required)
* @return Payment
* @http.response.details
Status Code
Description
Response Headers
201
Default Response
* ratelimit-limit - The request limit quota for the time window closest to exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-remaining - The number of requests remaining in the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-reset - The number of seconds until the quota resets for the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * zuora-request-id - Zuora’s internal identifier for this request. * zuora-track-id - A user-supplied identifier for this request. If you supply a `zuora-track-id` as a request header, Zuora returns the `zuora-track-id` as a response header.
400
Bad Request
-
401
Unauthorized
-
404
Not Found
-
405
Method Not Allowed
-
429
Too Many Requests
-
500
Internal Server Error
-
502
Bad Gateway
-
503
Service Unavailable
-
504
Gateway Timeout
-
*/
public CreatePaymentParams createPaymentParams(PaymentCreateRequest paymentCreateRequest) {
return new CreatePaymentParams(paymentCreateRequest);
}
public Payment createPayment(PaymentCreateRequest paymentCreateRequest) throws ApiException {
CreatePaymentParams params = new CreatePaymentParams(paymentCreateRequest);
return executeCreatePaymentAPICall(params).getData();
}
/**
* Expose HTTP info
public ApiResponse createPaymentWithHttpInfo(PaymentCreateRequest paymentCreateRequest) throws ApiException {
CreatePaymentParams params = new CreatePaymentParams(paymentCreateRequest);
return executeCreatePaymentAPICall(params);
}
**/
/**
Legacy Query Params Requests
**/
public Payment createPayment( PaymentCreateRequest paymentCreateRequest , List expand) throws ApiException {
CreatePaymentParams params = new CreatePaymentParams(paymentCreateRequest);
params.expand(expand);
return executeCreatePaymentAPICall(params).getData();
}
/*
* add header methods
*/
public Payment createPayment(PaymentCreateRequest paymentCreateRequest ,List expand,Headers headers) throws ApiException {
CreatePaymentParams params = new CreatePaymentParams(paymentCreateRequest)
.expand(expand)
.headers(headers);
return executeCreatePaymentAPICall(params).getData();
}
/**
* Create a payment
* Creates a new payment object.
* @param params CreatePaymentParams
* @return Payment
* @http.response.details
Status Code
Description
Response Headers
201
Default Response
* ratelimit-limit - The request limit quota for the time window closest to exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-remaining - The number of requests remaining in the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * ratelimit-reset - The number of seconds until the quota resets for the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/rest-api/general-concepts/rate-concurrency-limits/#rate-limits) for more information. * zuora-request-id - Zuora’s internal identifier for this request. * zuora-track-id - A user-supplied identifier for this request. If you supply a `zuora-track-id` as a request header, Zuora returns the `zuora-track-id` as a response header.
400
Bad Request
-
401
Unauthorized
-
404
Not Found
-
405
Method Not Allowed
-
429
Too Many Requests
-
500
Internal Server Error
-
502
Bad Gateway
-
503
Service Unavailable
-
504
Gateway Timeout
-
*/
public Payment create(CreatePaymentParams params) throws ApiException {
return executeCreatePaymentAPICall(params).getData();
}
public ApiResponse createWithHttpInfo(CreatePaymentParams params) throws ApiException {
return executeCreatePaymentAPICall(params);
}
ApiResponse executeCreatePaymentAPICall(CreatePaymentParams params) throws ApiException {
return createPaymentWithHttpInfo(params.paymentCreateRequest, params.fields, params.paymentFields, params.accountFields, params.paymentMethodFields, params.paymentAppliedToFields, params.paymentAppliedToItemsFields, params.expand, params.filter, params.pageSize, params.zuoraTrackId, params.async, params.zuoraCacheEnabled, params.zuoraEntityIds, params.idempotencyKey, params.acceptEncoding, params.contentEncoding, params.zuoraOrgIds);
}
private okhttp3.Call getPaymentCall(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
String basePath = null;
// Operation Servers
String[] localBasePaths = new String[] { };
// Determine Base Path to Use
if (localCustomBaseUrl != null){
basePath = localCustomBaseUrl;
} else if ( localBasePaths.length > 0 ) {
basePath = localBasePaths[localHostIndex];
} else {
basePath = null;
}
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/payments/{payment_id}"
.replace("{" + "payment_id" + "}", localVarApiClient.escapeString(paymentId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (fields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "fields[]", fields));
}
if (paymentFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment.fields[]", paymentFields));
}
if (accountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "account.fields[]", accountFields));
}
if (paymentMethodFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_method.fields[]", paymentMethodFields));
}
if (paymentAppliedToFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to.fields[]", paymentAppliedToFields));
}
if (paymentAppliedToItemsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "payment_applied_to_items.fields[]", paymentAppliedToItemsFields));
}
if (expand != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "expand[]", expand));
}
if (filter != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "filter[]", filter));
}
if (pageSize != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize));
}
if (zuoraTrackId != null) {
localVarHeaderParams.put("zuora-track-id", localVarApiClient.parameterToString(zuoraTrackId));
}
if (async != null) {
localVarHeaderParams.put("async", localVarApiClient.parameterToString(async));
}
if (zuoraCacheEnabled != null) {
localVarHeaderParams.put("zuora-cache-enabled", localVarApiClient.parameterToString(zuoraCacheEnabled));
}
if (zuoraEntityIds != null) {
localVarHeaderParams.put("zuora-entity-ids", localVarApiClient.parameterToString(zuoraEntityIds));
}
if (idempotencyKey != null) {
localVarHeaderParams.put("idempotency-key", localVarApiClient.parameterToString(idempotencyKey));
}
if (acceptEncoding != null) {
localVarHeaderParams.put("accept-encoding", localVarApiClient.parameterToString(acceptEncoding));
}
if (contentEncoding != null) {
localVarHeaderParams.put("content-encoding", localVarApiClient.parameterToString(contentEncoding));
}
if (zuoraOrgIds != null) {
localVarHeaderParams.put("zuora-org-ids", localVarApiClient.parameterToString(zuoraOrgIds));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "bearerAuth" };
return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getPaymentValidateBeforeCall(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'paymentId' is set
if (paymentId == null) {
throw new ApiException("Missing the required parameter 'paymentId' when calling getPayment(Async)");
}
return getPaymentCall(paymentId, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
}
private ApiResponse getPaymentWithHttpInfo(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds) throws ApiException {
okhttp3.Call localVarCall = getPaymentValidateBeforeCall(paymentId, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
throw e;
}
}
private okhttp3.Call getPaymentAsync(String paymentId, List fields, List paymentFields, List accountFields, List paymentMethodFields, List paymentAppliedToFields, List paymentAppliedToItemsFields, List expand, List filter, Integer pageSize, String zuoraTrackId, Boolean async, Boolean zuoraCacheEnabled, String zuoraEntityIds, String idempotencyKey, String acceptEncoding, String contentEncoding, String zuoraOrgIds, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getPaymentValidateBeforeCall(paymentId, fields, paymentFields, accountFields, paymentMethodFields, paymentAppliedToFields, paymentAppliedToItemsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
Type localVarReturnType = new TypeToken