All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.docusign.esign.api.BillingApi Maven / Gradle / Ivy

Go to download

The official DocuSign eSignature JAVA client is based on version 2 of the DocuSign REST API and provides libraries for JAVA application integration. It is recommended that you use this version of the library for new development.

There is a newer version: 6.0.0
Show newest version
package com.docusign.esign.api;

import com.docusign.esign.client.ApiClient;
import com.docusign.esign.client.ApiException;
import com.docusign.esign.client.ApiResponse;
import com.docusign.esign.client.Configuration;
import com.docusign.esign.client.Pair;
import com.docusign.esign.model.*;
import jakarta.ws.rs.core.GenericType;

/** BillingApi class. */
public class BillingApi {
  private ApiClient apiClient;

  /** BillingApi. */
  public BillingApi() {
    this(Configuration.getDefaultApiClient());
  }

  /** BillingApi. */
  public BillingApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * getApiClient Method.
   *
   * @return ApiClient
   */
  public ApiClient getApiClient() {
    return apiClient;
  }

  /** setApiClient Method. */
  public void setApiClient(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * Get the billing plan details.. Retrieves the billing plan details for the specified billing
   * plan ID.
   *
   * @param billingPlanId The ID of the billing plan being accessed. (required)
   * @return BillingPlanResponse
   * @throws ApiException if fails to make API call
   */
  public BillingPlanResponse getBillingPlan(String billingPlanId) throws ApiException {
    ApiResponse localVarResponse = getBillingPlanWithHttpInfo(billingPlanId);
    return localVarResponse.getData();
  }

  /**
   * Get the billing plan details. Retrieves the billing plan details for the specified billing plan
   * ID.
   *
   * @param billingPlanId The ID of the billing plan being accessed. (required)
   * @return BillingPlanResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getBillingPlanWithHttpInfo(String billingPlanId)
      throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'billingPlanId' is set
    if (billingPlanId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'billingPlanId' when calling getBillingPlan");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/billing_plans/{billingPlanId}"
            .replaceAll(
                "\\{" + "billingPlanId" + "\\}", apiClient.escapeString(billingPlanId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType = new GenericType() {};
    BillingPlanResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Get metadata for a given credit card.. This method returns information about a credit card
   * associated with an account.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return CreditCardInformation
   * @throws ApiException if fails to make API call
   */
  public CreditCardInformation getCreditCardInfo(String accountId) throws ApiException {
    ApiResponse localVarResponse = getCreditCardInfoWithHttpInfo(accountId);
    return localVarResponse.getData();
  }

  /**
   * Get metadata for a given credit card. This method returns information about a credit card
   * associated with an account.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return CreditCardInformation
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getCreditCardInfoWithHttpInfo(String accountId)
      throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling getCreditCardInfo");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_plan/credit_card"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    CreditCardInformation localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Returns downgrade plan information for the specified account..
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return DowngradRequestBillingInfoResponse
   * @throws ApiException if fails to make API call
   */
  public DowngradRequestBillingInfoResponse getDowngradeRequestBillingInfo(String accountId)
      throws ApiException {
    ApiResponse localVarResponse =
        getDowngradeRequestBillingInfoWithHttpInfo(accountId);
    return localVarResponse.getData();
  }

  /**
   * Returns downgrade plan information for the specified account.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return DowngradRequestBillingInfoResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getDowngradeRequestBillingInfoWithHttpInfo(
      String accountId) throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400,
          "Missing the required parameter 'accountId' when calling getDowngradeRequestBillingInfo");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_plan/downgrade"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    DowngradRequestBillingInfoResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Retrieves a billing invoice.. Retrieves the specified invoice. ###### Note: If the
   * `pdfAvailable` property in the response is set to *true*, you can download a PDF
   * version of the invoice. To download the PDF, make the call again and change the value of the
   * `Accept` property in the header to `Accept: application/pdf`. Privileges
   * required: account administrator The response returns a list of charges and information about
   * the charges. Quantities are usually shown as 'unlimited' or an integer. Amounts are
   * shown in the currency set for the account. **Response** The following table provides a
   * description of the different `chargeName` property values. The information will grow
   * as more chargeable items are added to the system. | chargeName | Description | | --- | --- | |
   * id_check | ID Check Charge | | in_person_signing | In Person Signing charge | | envelopes
   * Included | Sent Envelopes for the account | | age_verify | Age verification check | | ofac |
   * OFAC Check | | id_confirm | ID confirmation check | | student_authentication | STAN PIN
   * authentication check | | wet_sign_fax | Pages for returning signed documents by fax | |
   * attachment_fax | Pages for returning attachments by fax | | phone_authentication | Phone
   * authentication charge | | powerforms | PowerForm envelopes sent | | signer_payments | Payment
   * processing charge | | outbound_fax | Send by fax charge | | bulk_recipient_envelopes | Bulk
   * Recipient Envelopes sent | | sms_authentications | SMS authentication charge | |
   * saml_authentications | SAML authentication charge | | express_signer_certificate | DocuSign
   * Express Certificate charge | | personal_signer_certificate | Personal Signer Certificate charge
   * | | safe_certificate | SAFE BioPharma Signer Certificate charge | | seats | Included active
   * seats charge | | open_trust_certificate | OpenTrust Signer Certificate charge |
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param invoiceId (required)
   * @return BillingInvoice
   * @throws ApiException if fails to make API call
   */
  public BillingInvoice getInvoice(String accountId, String invoiceId) throws ApiException {
    ApiResponse localVarResponse = getInvoiceWithHttpInfo(accountId, invoiceId);
    return localVarResponse.getData();
  }

  /**
   * Retrieves a billing invoice. Retrieves the specified invoice. ###### Note: If the
   * `pdfAvailable` property in the response is set to *true*, you can download a PDF
   * version of the invoice. To download the PDF, make the call again and change the value of the
   * `Accept` property in the header to `Accept: application/pdf`. Privileges
   * required: account administrator The response returns a list of charges and information about
   * the charges. Quantities are usually shown as 'unlimited' or an integer. Amounts are
   * shown in the currency set for the account. **Response** The following table provides a
   * description of the different `chargeName` property values. The information will grow
   * as more chargeable items are added to the system. | chargeName | Description | | --- | --- | |
   * id_check | ID Check Charge | | in_person_signing | In Person Signing charge | | envelopes
   * Included | Sent Envelopes for the account | | age_verify | Age verification check | | ofac |
   * OFAC Check | | id_confirm | ID confirmation check | | student_authentication | STAN PIN
   * authentication check | | wet_sign_fax | Pages for returning signed documents by fax | |
   * attachment_fax | Pages for returning attachments by fax | | phone_authentication | Phone
   * authentication charge | | powerforms | PowerForm envelopes sent | | signer_payments | Payment
   * processing charge | | outbound_fax | Send by fax charge | | bulk_recipient_envelopes | Bulk
   * Recipient Envelopes sent | | sms_authentications | SMS authentication charge | |
   * saml_authentications | SAML authentication charge | | express_signer_certificate | DocuSign
   * Express Certificate charge | | personal_signer_certificate | Personal Signer Certificate charge
   * | | safe_certificate | SAFE BioPharma Signer Certificate charge | | seats | Included active
   * seats charge | | open_trust_certificate | OpenTrust Signer Certificate charge |
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param invoiceId (required)
   * @return BillingInvoice
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getInvoiceWithHttpInfo(String accountId, String invoiceId)
      throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling getInvoice");
    }

    // verify the required parameter 'invoiceId' is set
    if (invoiceId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'invoiceId' when calling getInvoice");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_invoices/{invoiceId}"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()))
            .replaceAll("\\{" + "invoiceId" + "\\}", apiClient.escapeString(invoiceId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType = new GenericType() {};
    BillingInvoice localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Gets billing payment information for a specific payment.. Retrieves the information for a
   * specified payment. Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param paymentId (required)
   * @return BillingPaymentItem
   * @throws ApiException if fails to make API call
   */
  public BillingPaymentItem getPayment(String accountId, String paymentId) throws ApiException {
    ApiResponse localVarResponse = getPaymentWithHttpInfo(accountId, paymentId);
    return localVarResponse.getData();
  }

  /**
   * Gets billing payment information for a specific payment. Retrieves the information for a
   * specified payment. Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param paymentId (required)
   * @return BillingPaymentItem
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getPaymentWithHttpInfo(String accountId, String paymentId)
      throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling getPayment");
    }

    // verify the required parameter 'paymentId' is set
    if (paymentId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'paymentId' when calling getPayment");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_payments/{paymentId}"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()))
            .replaceAll("\\{" + "paymentId" + "\\}", apiClient.escapeString(paymentId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType = new GenericType() {};
    BillingPaymentItem localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }
  /// 
  /// Get Account Billing Plan Retrieves the billing plan information for the specified account,
  // including the current billing plan, successor plans, billing address, and billing credit card.
  // By default the successor plan and credit card information is included in the response. This
  // information can be excluded from the response by adding the appropriate optional query string
  // with the `setting` set to **false**.   Response  The response returns the billing
  // plan information, including the currency code, for the plan. The `billingPlan` and
  // `succesorPlans` property values are the same as those shown in the [ML:Get Billing
  // Plan Details] reference. the `billingAddress` and `creditCardInformation`
  // property values are the same as those shown in the [ML:Update Billing Plan] reference.  ######
  // Note: When credit card number information is shown, a mask is applied to the response so that
  // only the last 4 digits of the card number are visible.
  /// 

  /** GetPlanOptions Class. */
  public class GetPlanOptions {
    private String includeCreditCardInformation = null;
    private String includeDowngradeInformation = null;
    private String includeMetadata = null;
    private String includeSuccessorPlans = null;
    private String includeTaxExemptId = null;

    /** setIncludeCreditCardInformation method. */
    public void setIncludeCreditCardInformation(String includeCreditCardInformation) {
      this.includeCreditCardInformation = includeCreditCardInformation;
    }

    /**
     * getIncludeCreditCardInformation method.
     *
     * @return String
     */
    public String getIncludeCreditCardInformation() {
      return this.includeCreditCardInformation;
    }

    /** setIncludeDowngradeInformation method. */
    public void setIncludeDowngradeInformation(String includeDowngradeInformation) {
      this.includeDowngradeInformation = includeDowngradeInformation;
    }

    /**
     * getIncludeDowngradeInformation method.
     *
     * @return String
     */
    public String getIncludeDowngradeInformation() {
      return this.includeDowngradeInformation;
    }

    /** setIncludeMetadata method. */
    public void setIncludeMetadata(String includeMetadata) {
      this.includeMetadata = includeMetadata;
    }

    /**
     * getIncludeMetadata method.
     *
     * @return String
     */
    public String getIncludeMetadata() {
      return this.includeMetadata;
    }

    /** setIncludeSuccessorPlans method. */
    public void setIncludeSuccessorPlans(String includeSuccessorPlans) {
      this.includeSuccessorPlans = includeSuccessorPlans;
    }

    /**
     * getIncludeSuccessorPlans method.
     *
     * @return String
     */
    public String getIncludeSuccessorPlans() {
      return this.includeSuccessorPlans;
    }

    /** setIncludeTaxExemptId method. */
    public void setIncludeTaxExemptId(String includeTaxExemptId) {
      this.includeTaxExemptId = includeTaxExemptId;
    }

    /**
     * getIncludeTaxExemptId method.
     *
     * @return String
     */
    public String getIncludeTaxExemptId() {
      return this.includeTaxExemptId;
    }
  }

  /**
   * Get Account Billing Plan. Retrieves the billing plan information for the specified account,
   * including the current billing plan, successor plans, billing address, and billing credit card.
   * By default the successor plan and credit card information is included in the response. This
   * information can be excluded from the response by adding the appropriate optional query string
   * with the `setting` set to **false**. Response The response returns the billing plan
   * information, including the currency code, for the plan. The `billingPlan` and
   * `succesorPlans` property values are the same as those shown in the [ML:Get Billing
   * Plan Details] reference. the `billingAddress` and `creditCardInformation`
   * property values are the same as those shown in the [ML:Update Billing Plan] reference. ######
   * Note: When credit card number information is shown, a mask is applied to the response so that
   * only the last 4 digits of the card number are visible.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return AccountBillingPlanResponse
   */
  public AccountBillingPlanResponse getPlan(String accountId) throws ApiException {
    return getPlan(accountId, null);
  }

  /**
   * Get Account Billing Plan. Retrieves the billing plan information for the specified account,
   * including the current billing plan, successor plans, billing address, and billing credit card.
   * By default the successor plan and credit card information is included in the response. This
   * information can be excluded from the response by adding the appropriate optional query string
   * with the `setting` set to **false**. Response The response returns the billing plan
   * information, including the currency code, for the plan. The `billingPlan` and
   * `succesorPlans` property values are the same as those shown in the [ML:Get Billing
   * Plan Details] reference. the `billingAddress` and `creditCardInformation`
   * property values are the same as those shown in the [ML:Update Billing Plan] reference. ######
   * Note: When credit card number information is shown, a mask is applied to the response so that
   * only the last 4 digits of the card number are visible.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param options for modifying the method behavior.
   * @return AccountBillingPlanResponse
   * @throws ApiException if fails to make API call
   */
  public AccountBillingPlanResponse getPlan(String accountId, BillingApi.GetPlanOptions options)
      throws ApiException {
    ApiResponse localVarResponse =
        getPlanWithHttpInfo(accountId, options);
    return localVarResponse.getData();
  }

  /**
   * Get Account Billing Plan Retrieves the billing plan information for the specified account,
   * including the current billing plan, successor plans, billing address, and billing credit card.
   * By default the successor plan and credit card information is included in the response. This
   * information can be excluded from the response by adding the appropriate optional query string
   * with the `setting` set to **false**. Response The response returns the billing plan
   * information, including the currency code, for the plan. The `billingPlan` and
   * `succesorPlans` property values are the same as those shown in the [ML:Get Billing
   * Plan Details] reference. the `billingAddress` and `creditCardInformation`
   * property values are the same as those shown in the [ML:Update Billing Plan] reference. ######
   * Note: When credit card number information is shown, a mask is applied to the response so that
   * only the last 4 digits of the card number are visible.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param options for modifying the method behavior.
   * @return AccountBillingPlanResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse getPlanWithHttpInfo(
      String accountId, BillingApi.GetPlanOptions options) throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling getPlan");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_plan"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    if (options != null) {
      localVarQueryParams.addAll(
          apiClient.parameterToPair(
              "include_credit_card_information", options.includeCreditCardInformation));
    }
    if (options != null) {
      localVarQueryParams.addAll(
          apiClient.parameterToPair(
              "include_downgrade_information", options.includeDowngradeInformation));
    }
    if (options != null) {
      localVarQueryParams.addAll(
          apiClient.parameterToPair("include_metadata", options.includeMetadata));
    }
    if (options != null) {
      localVarQueryParams.addAll(
          apiClient.parameterToPair("include_successor_plans", options.includeSuccessorPlans));
    }
    if (options != null) {
      localVarQueryParams.addAll(
          apiClient.parameterToPair("include_tax_exempt_id", options.includeTaxExemptId));
    }

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    AccountBillingPlanResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Gets the list of available billing plans.. Retrieves a list of the billing plans associated
   * with a distributor.
   *
   * @return BillingPlansResponse
   * @throws ApiException if fails to make API call
   */
  public BillingPlansResponse listBillingPlans() throws ApiException {
    ApiResponse localVarResponse = listBillingPlansWithHttpInfo();
    return localVarResponse.getData();
  }

  /**
   * Gets the list of available billing plans. Retrieves a list of the billing plans associated with
   * a distributor.
   *
   * @return BillingPlansResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse listBillingPlansWithHttpInfo() throws ApiException {
    Object localVarPostBody = "{}";

    // create path and map variables
    String localVarPath = "/v2.1/billing_plans";

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    BillingPlansResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }
  /// 
  /// Get a List of Billing Invoices Retrieves a list of invoices for the account. If the from date
  // or to date queries are not specified, the response returns invoices for the last 365 days.
  // Privileges required: account administrator
  /// 

  /** ListInvoicesOptions Class. */
  public class ListInvoicesOptions {
    private String fromDate = null;
    private String toDate = null;

    /** setFromDate method. */
    public void setFromDate(String fromDate) {
      this.fromDate = fromDate;
    }

    /**
     * getFromDate method.
     *
     * @return String
     */
    public String getFromDate() {
      return this.fromDate;
    }

    /** setToDate method. */
    public void setToDate(String toDate) {
      this.toDate = toDate;
    }

    /**
     * getToDate method.
     *
     * @return String
     */
    public String getToDate() {
      return this.toDate;
    }
  }

  /**
   * Get a List of Billing Invoices. Retrieves a list of invoices for the account. If the from date
   * or to date queries are not specified, the response returns invoices for the last 365 days.
   * Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return BillingInvoicesResponse
   */
  public BillingInvoicesResponse listInvoices(String accountId) throws ApiException {
    return listInvoices(accountId, null);
  }

  /**
   * Get a List of Billing Invoices. Retrieves a list of invoices for the account. If the from date
   * or to date queries are not specified, the response returns invoices for the last 365 days.
   * Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param options for modifying the method behavior.
   * @return BillingInvoicesResponse
   * @throws ApiException if fails to make API call
   */
  public BillingInvoicesResponse listInvoices(
      String accountId, BillingApi.ListInvoicesOptions options) throws ApiException {
    ApiResponse localVarResponse =
        listInvoicesWithHttpInfo(accountId, options);
    return localVarResponse.getData();
  }

  /**
   * Get a List of Billing Invoices Retrieves a list of invoices for the account. If the from date
   * or to date queries are not specified, the response returns invoices for the last 365 days.
   * Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param options for modifying the method behavior.
   * @return BillingInvoicesResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse listInvoicesWithHttpInfo(
      String accountId, BillingApi.ListInvoicesOptions options) throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling listInvoices");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_invoices"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    if (options != null) {
      localVarQueryParams.addAll(apiClient.parameterToPair("from_date", options.fromDate));
    }
    if (options != null) {
      localVarQueryParams.addAll(apiClient.parameterToPair("to_date", options.toDate));
    }

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    BillingInvoicesResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Get a list of past due invoices.. Returns a list past due invoices for the account and notes if
   * payment can be made through the REST API. Privileges Required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return BillingInvoicesSummary
   * @throws ApiException if fails to make API call
   */
  public BillingInvoicesSummary listInvoicesPastDue(String accountId) throws ApiException {
    ApiResponse localVarResponse =
        listInvoicesPastDueWithHttpInfo(accountId);
    return localVarResponse.getData();
  }

  /**
   * Get a list of past due invoices. Returns a list past due invoices for the account and notes if
   * payment can be made through the REST API. Privileges Required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return BillingInvoicesSummary
   * @throws ApiException if fails to make API call
   */
  public ApiResponse listInvoicesPastDueWithHttpInfo(String accountId)
      throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling listInvoicesPastDue");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_invoices_past_due"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    BillingInvoicesSummary localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }
  /// 
  /// Gets payment information for one or more payments. Retrieves a list containing information
  // about one or more payments. If the from date or to date queries are not used, the response
  // returns payment information for the last 365 days.   Privileges required: account administrator
  /// 

  /** ListPaymentsOptions Class. */
  public class ListPaymentsOptions {
    private String fromDate = null;
    private String toDate = null;

    /** setFromDate method. */
    public void setFromDate(String fromDate) {
      this.fromDate = fromDate;
    }

    /**
     * getFromDate method.
     *
     * @return String
     */
    public String getFromDate() {
      return this.fromDate;
    }

    /** setToDate method. */
    public void setToDate(String toDate) {
      this.toDate = toDate;
    }

    /**
     * getToDate method.
     *
     * @return String
     */
    public String getToDate() {
      return this.toDate;
    }
  }

  /**
   * Gets payment information for one or more payments.. Retrieves a list containing information
   * about one or more payments. If the from date or to date queries are not used, the response
   * returns payment information for the last 365 days. Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @return BillingPaymentsResponse
   */
  public BillingPaymentsResponse listPayments(String accountId) throws ApiException {
    return listPayments(accountId, null);
  }

  /**
   * Gets payment information for one or more payments.. Retrieves a list containing information
   * about one or more payments. If the from date or to date queries are not used, the response
   * returns payment information for the last 365 days. Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param options for modifying the method behavior.
   * @return BillingPaymentsResponse
   * @throws ApiException if fails to make API call
   */
  public BillingPaymentsResponse listPayments(
      String accountId, BillingApi.ListPaymentsOptions options) throws ApiException {
    ApiResponse localVarResponse =
        listPaymentsWithHttpInfo(accountId, options);
    return localVarResponse.getData();
  }

  /**
   * Gets payment information for one or more payments. Retrieves a list containing information
   * about one or more payments. If the from date or to date queries are not used, the response
   * returns payment information for the last 365 days. Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param options for modifying the method behavior.
   * @return BillingPaymentsResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse listPaymentsWithHttpInfo(
      String accountId, BillingApi.ListPaymentsOptions options) throws ApiException {
    Object localVarPostBody = "{}";

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling listPayments");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_payments"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    if (options != null) {
      localVarQueryParams.addAll(apiClient.parameterToPair("from_date", options.fromDate));
    }
    if (options != null) {
      localVarQueryParams.addAll(apiClient.parameterToPair("to_date", options.toDate));
    }

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    BillingPaymentsResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "GET",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Posts a payment to a past due invoice.. Posts a payment to a past due invoice. ###### Note:
   * This can only be used if the `paymentAllowed` value for a past due invoice is true.
   * This can be determined calling [ML:GetBillingInvoicesPastDue]. The response returns information
   * for a single payment, if a payment ID was used in the endpoint, or a list of payments. If the
   * from date or to date queries or payment ID are not used, the response returns payment
   * information for the last 365 days. If the request was for a single payment ID, the
   * `nextUri` and `previousUri` properties are not returned. Privileges
   * required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param billingPaymentRequest (optional)
   * @return BillingPaymentResponse
   * @throws ApiException if fails to make API call
   */
  public BillingPaymentResponse makePayment(
      String accountId, BillingPaymentRequest billingPaymentRequest) throws ApiException {
    ApiResponse localVarResponse =
        makePaymentWithHttpInfo(accountId, billingPaymentRequest);
    return localVarResponse.getData();
  }

  /**
   * Posts a payment to a past due invoice. Posts a payment to a past due invoice. ###### Note: This
   * can only be used if the `paymentAllowed` value for a past due invoice is true. This
   * can be determined calling [ML:GetBillingInvoicesPastDue]. The response returns information for
   * a single payment, if a payment ID was used in the endpoint, or a list of payments. If the from
   * date or to date queries or payment ID are not used, the response returns payment information
   * for the last 365 days. If the request was for a single payment ID, the `nextUri` and
   * `previousUri` properties are not returned. Privileges required: account administrator
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param billingPaymentRequest (optional)
   * @return BillingPaymentResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse makePaymentWithHttpInfo(
      String accountId, BillingPaymentRequest billingPaymentRequest) throws ApiException {
    Object localVarPostBody = billingPaymentRequest;

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling makePayment");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_payments"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    BillingPaymentResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "POST",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }

  /**
   * Reserverd: Purchase additional envelopes.. Reserved: At this time, this endpoint is limited to
   * DocuSign internal use only. Completes the purchase of envelopes for your account. The actual
   * purchase is done as part of an internal workflow interaction with an envelope vendor.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param purchasedEnvelopesInformation (optional)
   * @throws ApiException if fails to make API call
   */
  public void purchaseEnvelopes(
      String accountId, PurchasedEnvelopesInformation purchasedEnvelopesInformation)
      throws ApiException {
    purchaseEnvelopesWithHttpInfo(accountId, purchasedEnvelopesInformation);
  }

  /**
   * Reserverd: Purchase additional envelopes. Reserved: At this time, this endpoint is limited to
   * DocuSign internal use only. Completes the purchase of envelopes for your account. The actual
   * purchase is done as part of an internal workflow interaction with an envelope vendor.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param purchasedEnvelopesInformation (optional)
   * @throws ApiException if fails to make API call
   */
  public ApiResponse purchaseEnvelopesWithHttpInfo(
      String accountId, PurchasedEnvelopesInformation purchasedEnvelopesInformation)
      throws ApiException {
    Object localVarPostBody = purchasedEnvelopesInformation;

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling purchaseEnvelopes");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_plan/purchased_envelopes"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    apiClient.invokeAPI(
        localVarPath,
        "PUT",
        localVarQueryParams,
        localVarCollectionQueryParams,
        localVarPostBody,
        localVarHeaderParams,
        localVarFormParams,
        localVarAccept,
        localVarContentType,
        localVarAuthNames,
        null);
    return new ApiResponse(apiClient.getStatusCode(), apiClient.getResponseHeaders(), null);
  }

  /**
   * Queues downgrade billing plan request for an account..
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param downgradeBillingPlanInformation (optional)
   * @return DowngradePlanUpdateResponse
   * @throws ApiException if fails to make API call
   */
  public DowngradePlanUpdateResponse updateDowngradeAccountBillingPlan(
      String accountId, DowngradeBillingPlanInformation downgradeBillingPlanInformation)
      throws ApiException {
    ApiResponse localVarResponse =
        updateDowngradeAccountBillingPlanWithHttpInfo(accountId, downgradeBillingPlanInformation);
    return localVarResponse.getData();
  }

  /**
   * Queues downgrade billing plan request for an account.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param downgradeBillingPlanInformation (optional)
   * @return DowngradePlanUpdateResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse updateDowngradeAccountBillingPlanWithHttpInfo(
      String accountId, DowngradeBillingPlanInformation downgradeBillingPlanInformation)
      throws ApiException {
    Object localVarPostBody = downgradeBillingPlanInformation;

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400,
          "Missing the required parameter 'accountId' when calling updateDowngradeAccountBillingPlan");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_plan/downgrade"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    DowngradePlanUpdateResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "PUT",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }
  /// 
  /// Updates the account billing plan. Updates the billing plan information, billing address, and
  // credit card information for the specified account.
  /// 

  /** UpdatePlanOptions Class. */
  public class UpdatePlanOptions {
    private String previewBillingPlan = null;

    /** setPreviewBillingPlan method. */
    public void setPreviewBillingPlan(String previewBillingPlan) {
      this.previewBillingPlan = previewBillingPlan;
    }

    /**
     * getPreviewBillingPlan method.
     *
     * @return String
     */
    public String getPreviewBillingPlan() {
      return this.previewBillingPlan;
    }
  }

  /**
   * Updates the account billing plan.. Updates the billing plan information, billing address, and
   * credit card information for the specified account.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param billingPlanInformation (optional)
   * @return BillingPlanUpdateResponse
   */
  public BillingPlanUpdateResponse updatePlan(
      String accountId, BillingPlanInformation billingPlanInformation) throws ApiException {
    return updatePlan(accountId, billingPlanInformation, null);
  }

  /**
   * Updates the account billing plan.. Updates the billing plan information, billing address, and
   * credit card information for the specified account.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param billingPlanInformation (optional)
   * @param options for modifying the method behavior.
   * @return BillingPlanUpdateResponse
   * @throws ApiException if fails to make API call
   */
  public BillingPlanUpdateResponse updatePlan(
      String accountId,
      BillingPlanInformation billingPlanInformation,
      BillingApi.UpdatePlanOptions options)
      throws ApiException {
    ApiResponse localVarResponse =
        updatePlanWithHttpInfo(accountId, billingPlanInformation, options);
    return localVarResponse.getData();
  }

  /**
   * Updates the account billing plan. Updates the billing plan information, billing address, and
   * credit card information for the specified account.
   *
   * @param accountId The external account number (int) or account ID Guid. (required)
   * @param billingPlanInformation (optional)
   * @param options for modifying the method behavior.
   * @return BillingPlanUpdateResponse
   * @throws ApiException if fails to make API call
   */
  public ApiResponse updatePlanWithHttpInfo(
      String accountId,
      BillingPlanInformation billingPlanInformation,
      BillingApi.UpdatePlanOptions options)
      throws ApiException {
    Object localVarPostBody = billingPlanInformation;

    // verify the required parameter 'accountId' is set
    if (accountId == null) {
      throw new ApiException(
          400, "Missing the required parameter 'accountId' when calling updatePlan");
    }

    // create path and map variables
    String localVarPath =
        "/v2.1/accounts/{accountId}/billing_plan"
            .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));

    // query params
    java.util.List localVarQueryParams = new java.util.ArrayList();
    java.util.List localVarCollectionQueryParams = new java.util.ArrayList();
    java.util.Map localVarHeaderParams = new java.util.HashMap();
    java.util.Map localVarFormParams = new java.util.HashMap();

    if (options != null) {
      localVarQueryParams.addAll(
          apiClient.parameterToPair("preview_billing_plan", options.previewBillingPlan));
    }

    final String[] localVarAccepts = {"application/json"};
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {};

    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {"docusignAccessCode"};

    GenericType localVarReturnType =
        new GenericType() {};
    BillingPlanUpdateResponse localVarResponse =
        apiClient.invokeAPI(
            localVarPath,
            "PUT",
            localVarQueryParams,
            localVarCollectionQueryParams,
            localVarPostBody,
            localVarHeaderParams,
            localVarFormParams,
            localVarAccept,
            localVarContentType,
            localVarAuthNames,
            localVarReturnType);
    return new ApiResponse(
        apiClient.getStatusCode(), apiClient.getResponseHeaders(), localVarResponse);
  }
}