org.openapitools.client.api.SubscriptionsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zuora-sdk-java Show documentation
Show all versions of zuora-sdk-java Show documentation
The SDK of JAVA language for Zuora pricing system
/*
* 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.CancelSubscriptionRequest;
import org.openapitools.client.model.ErrorResponse;
import org.openapitools.client.model.PauseSubscriptionRequest;
import org.openapitools.client.model.ResumeSubscriptionRequest;
import org.openapitools.client.model.Subscription;
import org.openapitools.client.model.SubscriptionActivateRequest;
import org.openapitools.client.model.SubscriptionCancelResponse;
import org.openapitools.client.model.SubscriptionCreateRequest;
import org.openapitools.client.model.SubscriptionListResponse;
import org.openapitools.client.model.SubscriptionPatchRequest;
import org.openapitools.client.model.SubscriptionPreviewExistingRequest;
import org.openapitools.client.model.SubscriptionPreviewRequest;
import org.openapitools.client.model.SubscriptionPreviewResponse;
import org.openapitools.client.model.SubscriptionVersionListResponse;
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 SubscriptionsApi {
private ApiClient localVarApiClient;
private int localHostIndex;
private String localCustomBaseUrl;
public SubscriptionsApi() {
this(Configuration.getDefaultApiClient());
}
public SubscriptionsApi(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 activateSubscriptionCall(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 = subscriptionActivateRequest;
// create path and map variables
String localVarPath = "/subscriptions/{subscription_id}/activate"
.replace("{" + "subscription_id" + "}", localVarApiClient.escapeString(subscriptionId.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 (subscriptionFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "subscription.fields[]", subscriptionFields));
}
if (subscriptionPlansFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "subscription_plans.fields[]", subscriptionPlansFields));
}
if (subscriptionItemsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "subscription_items.fields[]", subscriptionItemsFields));
}
if (accountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "account.fields[]", accountFields));
}
if (invoiceOwnerAccountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "invoice_owner_account.fields[]", invoiceOwnerAccountFields));
}
if (planFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "plan.fields[]", planFields));
}
if (productFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "product.fields[]", productFields));
}
if (priceFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "price.fields[]", priceFields));
}
if (billToFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "bill_to.fields[]", billToFields));
}
if (prepaidBalanceFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "prepaid_balance.fields[]", prepaidBalanceFields));
}
if (prepaidBalancesFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "prepaid_balances.fields[]", prepaidBalancesFields));
}
if (validityPeriodFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "validity_period.fields[]", validityPeriodFields));
}
if (transactionsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "transactions.fields[]", transactionsFields));
}
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 activateSubscriptionValidateBeforeCall(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 'subscriptionId' is set
if (subscriptionId == null) {
throw new ApiException("Missing the required parameter 'subscriptionId' when calling activateSubscription(Async)");
}
// verify the required parameter 'subscriptionActivateRequest' is set
if (subscriptionActivateRequest == null) {
throw new ApiException("Missing the required parameter 'subscriptionActivateRequest' when calling activateSubscription(Async)");
}
return activateSubscriptionCall(subscriptionId, subscriptionActivateRequest, fields, subscriptionFields, subscriptionPlansFields, subscriptionItemsFields, accountFields, invoiceOwnerAccountFields, planFields, productFields, priceFields, billToFields, prepaidBalanceFields, prepaidBalancesFields, validityPeriodFields, transactionsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
}
private ApiResponse activateSubscriptionWithHttpInfo(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 = activateSubscriptionValidateBeforeCall(subscriptionId, subscriptionActivateRequest, fields, subscriptionFields, subscriptionPlansFields, subscriptionItemsFields, accountFields, invoiceOwnerAccountFields, planFields, productFields, priceFields, billToFields, prepaidBalanceFields, prepaidBalancesFields, validityPeriodFields, transactionsFields, 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 activateSubscriptionAsync(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 = activateSubscriptionValidateBeforeCall(subscriptionId, subscriptionActivateRequest, fields, subscriptionFields, subscriptionPlansFields, subscriptionItemsFields, accountFields, invoiceOwnerAccountFields, planFields, productFields, priceFields, billToFields, prepaidBalanceFields, prepaidBalancesFields, validityPeriodFields, transactionsFields, 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 ActivateSubscriptionParams {
private final String subscriptionId;
private final SubscriptionActivateRequest subscriptionActivateRequest;
private Headers headers;
/*
* Check for list params
*/
private GetByIdQueryParams getByIdQueryParams;
private List fields;
private List subscriptionFields;
private List subscriptionPlansFields;
private List subscriptionItemsFields;
private List accountFields;
private List invoiceOwnerAccountFields;
private List planFields;
private List productFields;
private List priceFields;
private List billToFields;
private List prepaidBalanceFields;
private List prepaidBalancesFields;
private List validityPeriodFields;
private List transactionsFields;
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 ActivateSubscriptionParams(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest) {
this.subscriptionId = subscriptionId;
this.subscriptionActivateRequest = subscriptionActivateRequest;
}
/**
* Set getByIdQueryParams
* @param getByIdQueryParams GetByIdQueryParams
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams 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 ActivateSubscriptionParams
*/
public ActivateSubscriptionParams 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`, `subscription_number`, `state`, `account_id`, `invoice_owner_account_id`, `auto_renew`, `version`, `initial_term`, `current_term`, `renewal_term`, `start_date`, `end_date`, `description`, `contract_effective`, `service_activation`, `customer_acceptance`, `invoice_separately`, `latest_version`, `payment_terms`, `billing_document_settings`, `bill_to_id`, `sold_to_id`, `contracted_mrr`, `currency`, `cancel_reason`, `last_booking_date`, `order_number` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams fields(List fields) {
this.fields = fields;
return this;
}
/**
* Set subscriptionFields
* @param subscriptionFields 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`, `subscription_number`, `state`, `account_id`, `invoice_owner_account_id`, `auto_renew`, `version`, `initial_term`, `current_term`, `renewal_term`, `start_date`, `end_date`, `description`, `contract_effective`, `service_activation`, `customer_acceptance`, `invoice_separately`, `latest_version`, `payment_terms`, `billing_document_settings`, `bill_to_id`, `sold_to_id`, `contracted_mrr`, `currency`, `cancel_reason`, `last_booking_date`, `order_number` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams subscriptionFields(List subscriptionFields) {
this.subscriptionFields = subscriptionFields;
return this;
}
/**
* Set subscriptionPlansFields
* @param subscriptionPlansFields 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`, `name`, `plan_id`, `subscription_id`, `product_id`, `subscription_plan_number` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams subscriptionPlansFields(List subscriptionPlansFields) {
this.subscriptionPlansFields = subscriptionPlansFields;
return this;
}
/**
* Set subscriptionItemsFields
* @param subscriptionItemsFields 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`, `start_date`, `end_date`, `charge_model`, `charge_type`, `tiers`, `subscription_item_number`, `name`, `description`, `charged_through_date`, `recurring`, `price_id`, `start_event`, `tax_code`, `tax_inclusive`, `unit_of_measure`, `quantity`, `price_base_interval`, `overage`, `subscription_plan_id`, `tiers_mode`, `processed_through_date`, `active`, `state`, `unit_amount`, `amount`, `discount_amount`, `discount_percent`, `price_change_percentage`, `price_change_option` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams subscriptionItemsFields(List subscriptionItemsFields) {
this.subscriptionItemsFields = subscriptionItemsFields;
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 ActivateSubscriptionParams
*/
public ActivateSubscriptionParams accountFields(List accountFields) {
this.accountFields = accountFields;
return this;
}
/**
* Set invoiceOwnerAccountFields
* @param invoiceOwnerAccountFields 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 ActivateSubscriptionParams
*/
public ActivateSubscriptionParams invoiceOwnerAccountFields(List invoiceOwnerAccountFields) {
this.invoiceOwnerAccountFields = invoiceOwnerAccountFields;
return this;
}
/**
* Set planFields
* @param planFields 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`, `start_date`, `end_date`, `name`, `active`, `description`, `plan_number`, `product_id`, `active_currencies` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams planFields(List planFields) {
this.planFields = planFields;
return this;
}
/**
* Set productFields
* @param productFields 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`, `start_date`, `end_date`, `active`, `name`, `type`, `sku`, `description` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams productFields(List productFields) {
this.productFields = productFields;
return this;
}
/**
* Set priceFields
* @param priceFields 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`, `tiers`, `charge_model`, `charge_type`, `name`, `description`, `revenue_recognition_rule`, `stacked_discount`, `recognized_revenue_accounting_code`, `deferred_revenue_accounting_code`, `accounting_code`, `recurring`, `start_event`, `tax_code`, `tax_inclusive`, `taxable`, `unit_of_measure`, `quantity`, `min_quantity`, `max_quantity`, `price_base_interval`, `discount_level`, `overage`, `plan_id`, `tiers_mode`, `apply_discount_to`, `prepayment`, `drawdown`, `discount_amounts`, `unit_amounts`, `discount_percent`, `amounts`, `price_change_percentage`, `price_change_option`, `price_increase_option` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams priceFields(List priceFields) {
this.priceFields = priceFields;
return this;
}
/**
* Set billToFields
* @param billToFields 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`, `account_id`, `address`, `home_phone`, `first_name`, `last_name`, `email`, `work_email`, `nickname`, `other_phone`, `work_phone`, `mobile_phone`, `tax_region`, `other_phone_type`, `fax` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams billToFields(List billToFields) {
this.billToFields = billToFields;
return this;
}
/**
* Set prepaidBalanceFields
* @param prepaidBalanceFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `prepaid_UOM`, `start_date`, `end_date`, `total_balance`, `remaining_balance` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams prepaidBalanceFields(List prepaidBalanceFields) {
this.prepaidBalanceFields = prepaidBalanceFields;
return this;
}
/**
* Set prepaidBalancesFields
* @param prepaidBalancesFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `validity_periods` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams prepaidBalancesFields(List prepaidBalancesFields) {
this.prepaidBalancesFields = prepaidBalancesFields;
return this;
}
/**
* Set validityPeriodFields
* @param validityPeriodFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `prepaid_UOM`, `start_date`, `end_date`, `total_balance`, `remaining_balance`, `overage_rated_amount`, `overage_rated_quantity` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams validityPeriodFields(List validityPeriodFields) {
this.validityPeriodFields = validityPeriodFields;
return this;
}
/**
* Set transactionsFields
* @param transactionsFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `transaction_date`, `type`, `quantity` </details> (optional)
* @return ActivateSubscriptionParams
*/
public ActivateSubscriptionParams transactionsFields(List transactionsFields) {
this.transactionsFields = transactionsFields;
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 ActivateSubscriptionParams
*/
public ActivateSubscriptionParams 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 ActivateSubscriptionParams
*/
public ActivateSubscriptionParams 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 ActivateSubscriptionParams
*/
public ActivateSubscriptionParams pageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
}
/**
* Activate a subscription
* A subscription must be active before you can bill your subscribers. Activating a subscription requires entering at least one of the following dates: `contract_effective`, `service_activation`, and `customer_acceptance`. See [Billing Trigger Dates](https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/WA_Dates_in_Zuora/B_Subscription_and_Amendment_Dates#Billing_Trigger_Dates) for more information.
* @param subscriptionId Identifier for the subscription, either `subscription_number` or `subscription_id` (required)
* @param subscriptionActivateRequest (required)
* @return Subscription
* @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 ActivateSubscriptionParams activateSubscriptionParams(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest) {
return new ActivateSubscriptionParams(subscriptionId, subscriptionActivateRequest);
}
public Subscription activateSubscription(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest) throws ApiException {
ActivateSubscriptionParams params = new ActivateSubscriptionParams(subscriptionId, subscriptionActivateRequest);
return executeActivateSubscriptionAPICall(params).getData();
}
/**
* Expose HTTP info
public ApiResponse activateSubscriptionWithHttpInfo(String subscriptionId, SubscriptionActivateRequest subscriptionActivateRequest) throws ApiException {
ActivateSubscriptionParams params = new ActivateSubscriptionParams(subscriptionId, subscriptionActivateRequest);
return executeActivateSubscriptionAPICall(params);
}
**/
/**
Legacy Query Params Requests
**/
public Subscription activateSubscription( String subscriptionId , SubscriptionActivateRequest subscriptionActivateRequest , List expand) throws ApiException {
ActivateSubscriptionParams params = new ActivateSubscriptionParams(subscriptionId, subscriptionActivateRequest);
params.expand(expand);
return executeActivateSubscriptionAPICall(params).getData();
}
/*
* add header methods
*/
public Subscription activateSubscription(String subscriptionId , SubscriptionActivateRequest subscriptionActivateRequest ,List expand,Headers headers) throws ApiException {
ActivateSubscriptionParams params = new ActivateSubscriptionParams(subscriptionId, subscriptionActivateRequest)
.expand(expand)
.headers(headers);
return executeActivateSubscriptionAPICall(params).getData();
}
/**
* Activate a subscription
* A subscription must be active before you can bill your subscribers. Activating a subscription requires entering at least one of the following dates: `contract_effective`, `service_activation`, and `customer_acceptance`. See [Billing Trigger Dates](https://knowledgecenter.zuora.com/Billing/Billing_and_Payments/WA_Dates_in_Zuora/B_Subscription_and_Amendment_Dates#Billing_Trigger_Dates) for more information.
* @param params ActivateSubscriptionParams
* @return Subscription
* @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 Subscription activate(ActivateSubscriptionParams params) throws ApiException {
return executeActivateSubscriptionAPICall(params).getData();
}
public ApiResponse activateWithHttpInfo(ActivateSubscriptionParams params) throws ApiException {
return executeActivateSubscriptionAPICall(params);
}
ApiResponse executeActivateSubscriptionAPICall(ActivateSubscriptionParams params) throws ApiException {
return activateSubscriptionWithHttpInfo(params.subscriptionId, params.subscriptionActivateRequest, params.fields, params.subscriptionFields, params.subscriptionPlansFields, params.subscriptionItemsFields, params.accountFields, params.invoiceOwnerAccountFields, params.planFields, params.productFields, params.priceFields, params.billToFields, params.prepaidBalanceFields, params.prepaidBalancesFields, params.validityPeriodFields, params.transactionsFields, 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 cancelSubscriptionCall(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 = cancelSubscriptionRequest;
// create path and map variables
String localVarPath = "/subscriptions/{subscription_id}/cancel"
.replace("{" + "subscription_id" + "}", localVarApiClient.escapeString(subscriptionId.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 (subscriptionFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "subscription.fields[]", subscriptionFields));
}
if (subscriptionPlansFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "subscription_plans.fields[]", subscriptionPlansFields));
}
if (subscriptionItemsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "subscription_items.fields[]", subscriptionItemsFields));
}
if (accountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "account.fields[]", accountFields));
}
if (invoiceOwnerAccountFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "invoice_owner_account.fields[]", invoiceOwnerAccountFields));
}
if (planFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "plan.fields[]", planFields));
}
if (productFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "product.fields[]", productFields));
}
if (priceFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "price.fields[]", priceFields));
}
if (billToFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "bill_to.fields[]", billToFields));
}
if (prepaidBalanceFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "prepaid_balance.fields[]", prepaidBalanceFields));
}
if (prepaidBalancesFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "prepaid_balances.fields[]", prepaidBalancesFields));
}
if (validityPeriodFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "validity_period.fields[]", validityPeriodFields));
}
if (transactionsFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "transactions.fields[]", transactionsFields));
}
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 cancelSubscriptionValidateBeforeCall(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 'subscriptionId' is set
if (subscriptionId == null) {
throw new ApiException("Missing the required parameter 'subscriptionId' when calling cancelSubscription(Async)");
}
// verify the required parameter 'cancelSubscriptionRequest' is set
if (cancelSubscriptionRequest == null) {
throw new ApiException("Missing the required parameter 'cancelSubscriptionRequest' when calling cancelSubscription(Async)");
}
return cancelSubscriptionCall(subscriptionId, cancelSubscriptionRequest, fields, subscriptionFields, subscriptionPlansFields, subscriptionItemsFields, accountFields, invoiceOwnerAccountFields, planFields, productFields, priceFields, billToFields, prepaidBalanceFields, prepaidBalancesFields, validityPeriodFields, transactionsFields, expand, filter, pageSize, zuoraTrackId, async, zuoraCacheEnabled, zuoraEntityIds, idempotencyKey, acceptEncoding, contentEncoding, zuoraOrgIds, _callback);
}
private ApiResponse cancelSubscriptionWithHttpInfo(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 = cancelSubscriptionValidateBeforeCall(subscriptionId, cancelSubscriptionRequest, fields, subscriptionFields, subscriptionPlansFields, subscriptionItemsFields, accountFields, invoiceOwnerAccountFields, planFields, productFields, priceFields, billToFields, prepaidBalanceFields, prepaidBalancesFields, validityPeriodFields, transactionsFields, 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 cancelSubscriptionAsync(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 = cancelSubscriptionValidateBeforeCall(subscriptionId, cancelSubscriptionRequest, fields, subscriptionFields, subscriptionPlansFields, subscriptionItemsFields, accountFields, invoiceOwnerAccountFields, planFields, productFields, priceFields, billToFields, prepaidBalanceFields, prepaidBalancesFields, validityPeriodFields, transactionsFields, 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 CancelSubscriptionParams {
private final String subscriptionId;
private final CancelSubscriptionRequest cancelSubscriptionRequest;
private Headers headers;
/*
* Check for list params
*/
private GetByIdQueryParams getByIdQueryParams;
private List fields;
private List subscriptionFields;
private List subscriptionPlansFields;
private List subscriptionItemsFields;
private List accountFields;
private List invoiceOwnerAccountFields;
private List planFields;
private List productFields;
private List priceFields;
private List billToFields;
private List prepaidBalanceFields;
private List prepaidBalancesFields;
private List validityPeriodFields;
private List transactionsFields;
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 CancelSubscriptionParams(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest) {
this.subscriptionId = subscriptionId;
this.cancelSubscriptionRequest = cancelSubscriptionRequest;
}
/**
* Set getByIdQueryParams
* @param getByIdQueryParams GetByIdQueryParams
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams 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 CancelSubscriptionParams
*/
public CancelSubscriptionParams 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`, `subscription_number`, `state`, `account_id`, `invoice_owner_account_id`, `auto_renew`, `version`, `initial_term`, `current_term`, `renewal_term`, `start_date`, `end_date`, `description`, `contract_effective`, `service_activation`, `customer_acceptance`, `invoice_separately`, `latest_version`, `payment_terms`, `billing_document_settings`, `bill_to_id`, `sold_to_id`, `contracted_mrr`, `currency`, `cancel_reason`, `last_booking_date`, `order_number` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams fields(List fields) {
this.fields = fields;
return this;
}
/**
* Set subscriptionFields
* @param subscriptionFields 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`, `subscription_number`, `state`, `account_id`, `invoice_owner_account_id`, `auto_renew`, `version`, `initial_term`, `current_term`, `renewal_term`, `start_date`, `end_date`, `description`, `contract_effective`, `service_activation`, `customer_acceptance`, `invoice_separately`, `latest_version`, `payment_terms`, `billing_document_settings`, `bill_to_id`, `sold_to_id`, `contracted_mrr`, `currency`, `cancel_reason`, `last_booking_date`, `order_number` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams subscriptionFields(List subscriptionFields) {
this.subscriptionFields = subscriptionFields;
return this;
}
/**
* Set subscriptionPlansFields
* @param subscriptionPlansFields 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`, `name`, `plan_id`, `subscription_id`, `product_id`, `subscription_plan_number` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams subscriptionPlansFields(List subscriptionPlansFields) {
this.subscriptionPlansFields = subscriptionPlansFields;
return this;
}
/**
* Set subscriptionItemsFields
* @param subscriptionItemsFields 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`, `start_date`, `end_date`, `charge_model`, `charge_type`, `tiers`, `subscription_item_number`, `name`, `description`, `charged_through_date`, `recurring`, `price_id`, `start_event`, `tax_code`, `tax_inclusive`, `unit_of_measure`, `quantity`, `price_base_interval`, `overage`, `subscription_plan_id`, `tiers_mode`, `processed_through_date`, `active`, `state`, `unit_amount`, `amount`, `discount_amount`, `discount_percent`, `price_change_percentage`, `price_change_option` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams subscriptionItemsFields(List subscriptionItemsFields) {
this.subscriptionItemsFields = subscriptionItemsFields;
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 CancelSubscriptionParams
*/
public CancelSubscriptionParams accountFields(List accountFields) {
this.accountFields = accountFields;
return this;
}
/**
* Set invoiceOwnerAccountFields
* @param invoiceOwnerAccountFields 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 CancelSubscriptionParams
*/
public CancelSubscriptionParams invoiceOwnerAccountFields(List invoiceOwnerAccountFields) {
this.invoiceOwnerAccountFields = invoiceOwnerAccountFields;
return this;
}
/**
* Set planFields
* @param planFields 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`, `start_date`, `end_date`, `name`, `active`, `description`, `plan_number`, `product_id`, `active_currencies` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams planFields(List planFields) {
this.planFields = planFields;
return this;
}
/**
* Set productFields
* @param productFields 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`, `start_date`, `end_date`, `active`, `name`, `type`, `sku`, `description` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams productFields(List productFields) {
this.productFields = productFields;
return this;
}
/**
* Set priceFields
* @param priceFields 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`, `tiers`, `charge_model`, `charge_type`, `name`, `description`, `revenue_recognition_rule`, `stacked_discount`, `recognized_revenue_accounting_code`, `deferred_revenue_accounting_code`, `accounting_code`, `recurring`, `start_event`, `tax_code`, `tax_inclusive`, `taxable`, `unit_of_measure`, `quantity`, `min_quantity`, `max_quantity`, `price_base_interval`, `discount_level`, `overage`, `plan_id`, `tiers_mode`, `apply_discount_to`, `prepayment`, `drawdown`, `discount_amounts`, `unit_amounts`, `discount_percent`, `amounts`, `price_change_percentage`, `price_change_option`, `price_increase_option` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams priceFields(List priceFields) {
this.priceFields = priceFields;
return this;
}
/**
* Set billToFields
* @param billToFields 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`, `account_id`, `address`, `home_phone`, `first_name`, `last_name`, `email`, `work_email`, `nickname`, `other_phone`, `work_phone`, `mobile_phone`, `tax_region`, `other_phone_type`, `fax` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams billToFields(List billToFields) {
this.billToFields = billToFields;
return this;
}
/**
* Set prepaidBalanceFields
* @param prepaidBalanceFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `prepaid_UOM`, `start_date`, `end_date`, `total_balance`, `remaining_balance` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams prepaidBalanceFields(List prepaidBalanceFields) {
this.prepaidBalanceFields = prepaidBalanceFields;
return this;
}
/**
* Set prepaidBalancesFields
* @param prepaidBalancesFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `validity_periods` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams prepaidBalancesFields(List prepaidBalancesFields) {
this.prepaidBalancesFields = prepaidBalancesFields;
return this;
}
/**
* Set validityPeriodFields
* @param validityPeriodFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `prepaid_UOM`, `start_date`, `end_date`, `total_balance`, `remaining_balance`, `overage_rated_amount`, `overage_rated_quantity` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams validityPeriodFields(List validityPeriodFields) {
this.validityPeriodFields = validityPeriodFields;
return this;
}
/**
* Set transactionsFields
* @param transactionsFields Allows you to specify which fields are returned in the response. <details> <summary> Accepted values </summary> `transaction_date`, `type`, `quantity` </details> (optional)
* @return CancelSubscriptionParams
*/
public CancelSubscriptionParams transactionsFields(List transactionsFields) {
this.transactionsFields = transactionsFields;
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 CancelSubscriptionParams
*/
public CancelSubscriptionParams 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 CancelSubscriptionParams
*/
public CancelSubscriptionParams 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 CancelSubscriptionParams
*/
public CancelSubscriptionParams pageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
}
/**
* Cancel a subscription
* Cancels a subscription.
* @param subscriptionId Identifier for the subscription, either `subscription_number` or `subscription_id` (required)
* @param cancelSubscriptionRequest (required)
* @return SubscriptionCancelResponse
* @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 CancelSubscriptionParams cancelSubscriptionParams(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest) {
return new CancelSubscriptionParams(subscriptionId, cancelSubscriptionRequest);
}
public SubscriptionCancelResponse cancelSubscription(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest) throws ApiException {
CancelSubscriptionParams params = new CancelSubscriptionParams(subscriptionId, cancelSubscriptionRequest);
return executeCancelSubscriptionAPICall(params).getData();
}
/**
* Expose HTTP info
public ApiResponse cancelSubscriptionWithHttpInfo(String subscriptionId, CancelSubscriptionRequest cancelSubscriptionRequest) throws ApiException {
CancelSubscriptionParams params = new CancelSubscriptionParams(subscriptionId, cancelSubscriptionRequest);
return executeCancelSubscriptionAPICall(params);
}
**/
/**
Legacy Query Params Requests
**/
public SubscriptionCancelResponse cancelSubscription( String subscriptionId , CancelSubscriptionRequest cancelSubscriptionRequest , List expand) throws ApiException {
CancelSubscriptionParams params = new CancelSubscriptionParams(subscriptionId, cancelSubscriptionRequest);
params.expand(expand);
return executeCancelSubscriptionAPICall(params).getData();
}
/*
* add header methods
*/
public SubscriptionCancelResponse cancelSubscription(String subscriptionId , CancelSubscriptionRequest cancelSubscriptionRequest ,List expand,Headers headers) throws ApiException {
CancelSubscriptionParams params = new CancelSubscriptionParams(subscriptionId, cancelSubscriptionRequest)
.expand(expand)
.headers(headers);
return executeCancelSubscriptionAPICall(params).getData();
}
/**
* Cancel a subscription
* Cancels a subscription.
* @param params CancelSubscriptionParams
* @return SubscriptionCancelResponse
* @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 SubscriptionCancelResponse cancel(CancelSubscriptionParams params) throws ApiException {
return executeCancelSubscriptionAPICall(params).getData();
}
public ApiResponse cancelWithHttpInfo(CancelSubscriptionParams params) throws ApiException {
return executeCancelSubscriptionAPICall(params);
}
ApiResponse executeCancelSubscriptionAPICall(CancelSubscriptionParams params) throws ApiException {
return cancelSubscriptionWithHttpInfo(params.subscriptionId, params.cancelSubscriptionRequest, params.fields, params.subscriptionFields, params.subscriptionPlansFields, params.subscriptionItemsFields, params.accountFields, params.invoiceOwnerAccountFields, params.planFields, params.productFields, params.priceFields, params.billToFields, params.prepaidBalanceFields, params.prepaidBalancesFields, params.validityPeriodFields, params.transactionsFields, 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 createSubscriptionCall(SubscriptionCreateRequest subscriptionCreateRequest, List fields, List subscriptionFields, List subscriptionPlansFields, List subscriptionItemsFields, List accountFields, List invoiceOwnerAccountFields, List planFields, List productFields, List priceFields, List billToFields, List prepaidBalanceFields, List prepaidBalancesFields, List validityPeriodFields, List transactionsFields, 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 = subscriptionCreateRequest;
// create path and map variables
String localVarPath = "/subscriptions";
List localVarQueryParams = new ArrayList();
List